restate icon indicating copy to clipboard operation
restate copied to clipboard

Support sending headers in call/backgroundCall

Open slinkydeveloper opened this issue 3 years ago • 1 comments

Right now there is not way to support sending Metadata in call/backgroundCall. This is especially problematic to support things such as AuthN/AuthZ between services.

  • [ ] Implement the changes in the service-protocol messages to send the metadata
  • [ ] Define how the callee should receive the Metadata (header? StartMessage?)
  • [ ] Implement the logic to propagate metadata in the invoker
  • [ ] Implement the SDK API to send metadata
  • [ ] Implement the SDK API to receive metadata

slinkydeveloper avatar Jul 27 '22 11:07 slinkydeveloper

API Proposal

Java

Overload the call methods (including one way call and delayed call) to accept Metadata (the headers struct from gRPC):

var myClient = Greeter.newRestateClient()
myClient.greet()
myClient.greet(Metadata)

And/or add the Metadata as arguments when creating a client (this is more idiomatic for gRPC users, as that's how it works for Channels):

var myClient = Greeter.newRestateClient(metadata)
myClient.greet()

Typescript

Because we don't control the code generation, I guess we can only develop a solution where the metadata are passed through the client:

var myClient = new GreeterClientImpl(ctx.channel(metadata))
myClient.greet()

slinkydeveloper avatar Dec 06 '23 14:12 slinkydeveloper