You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking forward to try out #838 to get rid of low-level akka-http code hydrating every single response with gRPC metadata (HTTP trailer), but I could not find a hook in the generated Handlers to do so no matter what the status is - the only possibility to inject metadata being in the exception handler.
In my case, the metadata is the same across all methods of a service (so a new overload of Handler#apply with a generic => Metadata provider would do), but I can imagine some people would want to control it on per-method/request basis - this was briefly discussed in #179 (comment).
Is it worth adding opening a (small) PR with a new Handler#apply or should we consider changing (before 1.0) the return type of power api traits to return both a response and metadata?
Happy to read your thoughts!
The text was updated successfully, but these errors were encountered:
In my case, the metadata is the same across all methods of a service
Hmm, in that case it sounds fine to do it at the Akka HTTP level - perhaps we could provide some API's to make that easier. Putting it into the apply of the Handler is one option, but I wonder if we can make it even nicer by composing/wrapping the returned handler.
I can imagine some people would want to control it on per-method/request basis
I can also imagine this, but on the other hand we have seen relatively few actual real-life use cases for this in practice. It would make the power API's harder to use (returning a Future[Metadata, Future[Result]]?). Perhaps we should have an independent 'power option' for the request and the response?
Hmm, in that case it sounds fine to do it at the Akka HTTP level - perhaps we could provide some API's to make that easier. Putting it into the apply of the Handler is one option, but I wonder if we can make it even nicer by composing/wrapping the returned handler.
Interestingly, #887 does look like a generalization of this idea.
Short description
gRPC Metadata (implemented as HTTP headers/trailers) are currently supported via the power api flag in one direction only: the server can inspect what the client sent, but there is no way for the server to pass metadata to the client (unless the implementation wants to return a gRPC error code via a rich exception).
Details
I was looking forward to try out #838 to get rid of low-level akka-http code hydrating every single response with gRPC metadata (HTTP trailer), but I could not find a hook in the generated
Handler
s to do so no matter what the status is - the only possibility to inject metadata being in the exception handler.In my case, the metadata is the same across all methods of a service (so a new overload of
Handler#apply
with a generic=> Metadata
provider would do), but I can imagine some people would want to control it on per-method/request basis - this was briefly discussed in #179 (comment).Is it worth adding opening a (small) PR with a new
Handler#apply
or should we consider changing (before 1.0) the return type of power api traits to return both a response and metadata?Happy to read your thoughts!
The text was updated successfully, but these errors were encountered: