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
First of all, thank you for the very nice library. These stubs really simplify the implementation of gRPC in the Spring ecosystem.
We are using the Reactor gRPC stub generator, along with spring-grpc and Spring Boot and are running into impedance mismatches between the gRPC context and Reactor context. Because Spring uses the Reactor context for a bunch of cross-cutting concerns, such as transaction management, authn / authz, and tracing, we have found a need to provide an adapter between both context storage mechanisms.
This adapter would need to be called on every server (and maybe every client call?), in order to propagate the context values upstream.
Tricky Bits
The tricky bit is that there is not a way to enumerate all of the values in a gRPC context, so it would not be possible to have a generic adapter that transparently converts between the two values.
Instead, we need to provide a user-defined mechanism to convert between the two context values, so that users of this library can do the conversion that makes sense for their use-case.
Options for design
To add this feature, we will need a way for users to register this context adapter with the generated Reactor stubs. For this, I see a couple options:
ServiceLoader: Users could provide an implementation of this adapter interface that could be registered and loaded using Java's ServiceLoader mechanism
Code generation: Add another overrideable method to the generated stubs that would allow for customization of this context adapter
Some combination of the two
I am happy to work on a PR that would be a proof of concept of this feature, but wanted to lay my thoughts out in case someone had any suggestions on where the best approach might be.
The text was updated successfully, but these errors were encountered:
First of all, thank you for the very nice library. These stubs really simplify the implementation of gRPC in the Spring ecosystem.
We are using the Reactor gRPC stub generator, along with spring-grpc and Spring Boot and are running into impedance mismatches between the gRPC context and Reactor context. Because Spring uses the Reactor context for a bunch of cross-cutting concerns, such as transaction management, authn / authz, and tracing, we have found a need to provide an adapter between both context storage mechanisms.
This adapter would need to be called on every server (and maybe every client call?), in order to propagate the context values upstream.
Tricky Bits
The tricky bit is that there is not a way to enumerate all of the values in a gRPC context, so it would not be possible to have a generic adapter that transparently converts between the two values.
Instead, we need to provide a user-defined mechanism to convert between the two context values, so that users of this library can do the conversion that makes sense for their use-case.
Options for design
To add this feature, we will need a way for users to register this context adapter with the generated Reactor stubs. For this, I see a couple options:
ServiceLoader
: Users could provide an implementation of this adapter interface that could be registered and loaded using Java'sServiceLoader
mechanismI am happy to work on a PR that would be a proof of concept of this feature, but wanted to lay my thoughts out in case someone had any suggestions on where the best approach might be.
The text was updated successfully, but these errors were encountered: