Proposal: work with grpc-java team to provide binding layer and code generator for grpc-java
See original GitHub issueGrpc-java is a low-level api that is quite error prone to use without significant investment in code-generation and libraries encoding relevant concepts --e.g., (pagination, batching, etc.
The go use-case for grpc is much easier to get started with for applications largely due to channels and context propagation being part of the stub generation. Kotlin Coroutines can provide an even better experience out of the box, completely eliminating the need for Streaming libraries or a lot of the utilities provided by a library like gax --e.g., Batching and Paging would be much easier to codify on a per application bases.
At the moment we are prototyping with a glue layer that connects grpc-java concepts per request. The bidi stream use case in this context would code generate a method that creates a job that does:
- Glue a
Channel
to the inputStreamObserver
- Glue
LinkedListChannel
to the outStreamObserver
. - Bind Grpc context to Coroutine Context or create a dispatcher using
Context::fixedContextExecutor
. - Propogate Context cancelation to the Job.
This is quite heavy handed. Ideally we should have a fully kotlinx.coroutine based layer perhaps directly above Netty that sidesteps the need to use the grpc-java layer and it would be fully coroutine based from the ground up.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:30
- Comments:12 (3 by maintainers)
Top GitHub Comments
I know its been a while but wanted to give a status update. The PR for the initial implementation has been opened under the kroto-plus repo https://github.com/marcoferrer/kroto-plus/pull/16 and contains all of the code generation and updated apis, along with an example project and snapshot for users to try out.
The goal is to release under kroto initially and iterate on the feedback from the users of that project. The plan afterwards will be to port the apis and code gen to this repo.
Feedback is welcomed and encouraged.
Here are some key points taken from the PR
Closing this one. See https://github.com/grpc/grpc-kotlin