Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow returning metadata alongside success values #323

Open
NavidJalali opened this issue Jun 3, 2024 · 5 comments
Open

Allow returning metadata alongside success values #323

NavidJalali opened this issue Jun 3, 2024 · 5 comments

Comments

@NavidJalali
Copy link
Contributor

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?

@NavidJalali
Copy link
Contributor Author

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
Copy link
Contributor

This looks like akka/akka-grpc#872 - so far, there seems to be no support for this.

@NavidJalali
Copy link
Contributor Author

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

@pjfanning
Copy link
Contributor

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

  • you will need a codegen enhancement - maybe support a new codegen config that works alongside the existing server_power_apis option
  • you will also need to then be able to take the Future[(Result, Metadata] and to generate a Pekko HTTP response from that.

Another option is to try to build something like akka/akka-grpc#887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants