line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.78k stars 906 forks source link

Support streaming services for JSON transcoding #5832

Open jrhee17 opened 1 month ago

jrhee17 commented 1 month ago

Currently, Armeria's HttpJsonTranscodingService doesn't support streaming messages and throws an exception.

https://github.com/line/armeria/blob/104855af85783b40aba4750a15b5b79159f65e3a/grpc/src/main/java/com/linecorp/armeria/server/grpc/HttpJsonTranscodingService.java#L162-L165

Recently, we saw an issue where some users with streaming services in their proto files weren't able to use transcoding at all since the above exception was thrown. https://github.com/line/armeria/issues/5828 https://github.com/line/armeria/pull/5829

Although a workaround was added to log a warning instead of throwing an exception, this also probably isn't ideal since users will still see warning logs for which they can't (and shouldn't) take action.

Moreover, it seems like grpc-gateway supports streaming as seen in the following issue where ndjson is used: https://github.com/grpc-ecosystem/grpc-gateway/issues/581

In an effort to 1) remove this discrepancy with upstream and 2) remove unnecessary warning logs, I suggest that we also support streaming messages for HttpJsonTranscodingService.

jrhee17 commented 1 month ago

Note: At least to follow-up on https://github.com/line/armeria/pull/5829, we may want to consider returning a 405 Method Not Allowed when a request to a streaming service is made until this issue is fully addressed.