0

What option can I set for ScalaPB code generation where the methods for the service implementation have access to metadata?

Default options generate something like:

override def sayHello(req: HelloRequest) = {
...
}

And I would like something like:

override def sayHello(req: HelloRequest, metadata: Metadata) = {
...
}

--- Update December, 30th, 2021 ---

One reason is that I might want to retrieve the client's token from the metadata, so I can use that token to call another service.

Cassio
  • 1,347
  • 13
  • 15
  • 1
    To prevent a possible XY problem, why do you want the metadata? – stefanobaghino Mar 16 '20 at 06:19
  • There isn't a way to generate a signature like this currently in ScalaPB. The behavior is similar to grpc-java. The way to accomplish most of the use cases is using ServerInterceptor and Context. – thesamet Mar 16 '20 at 07:07

0 Answers0