apache / pekko-grpc

Apache Pekko gRPC
https://pekko.apache.org/
Apache License 2.0
39 stars 17 forks source link

Allow returning metadata alongside success values #323

Open NavidJalali opened 4 months ago

NavidJalali commented 4 months ago

In the current API grpc metadata is only allowed to be read from (using the power API) or written to in the case of an error using the rich error model. Would it be possible to add metadata alongside the success values?

pjfanning commented 4 months ago

There is already:

NavidJalali commented 3 months ago

Hey @pjfanning thank you for the prompt response. So client side is okay for me. On the server side, I can quite easily read the metadata as well. The problem lies however with writing the metadata on the server side when the response is NOT an error. If the response IS an error then using the GrpcServiceException lets me provide the Metadata but for the successful channel I only get to succeed with a Future[Result] whereas I would like to be able to also write the metadata with a Future[(Result, Metadata)].

pjfanning commented 3 months ago

This looks like https://github.com/akka/akka-grpc/issues/872 - so far, there seems to be no support for this.

NavidJalali commented 3 months ago

Do you have ideas on how we could go about adding such support? I could perhaps give it a shot

pjfanning commented 3 months ago

There are a few problems to solve if you want the Server to support Future[(Result, Metadata].

Another option is to try to build something like https://github.com/akka/akka-grpc/issues/887