question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: work with grpc-java team to provide binding layer and code generator for grpc-java

See original GitHub issue

Grpc-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:

  1. Glue a Channel to the input StreamObserver
  2. Glue LinkedListChannel to the out StreamObserver.
  3. Bind Grpc context to Coroutine Context or create a dispatcher using Context::fixedContextExecutor.
  4. 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:closed
  • Created 5 years ago
  • Reactions:30
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
marcoferrercommented, Jan 8, 2019

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

  1. All around better integration with Structured Concurrency
  2. Backpressure Support has been implemented.
  3. Generation of Client Stubs which implement the CoroutineScope interface
    • Allows client stubs to work well with Structured Concurrency
    • Cancellations can now be propagated across usages of a specific stub instance.
  4. Generation of abstract Service Base Impl’s
    • Allows services to still support common grpc-java patterns, while still fully embracing coroutine idioms and features.
0reactions
elizarovcommented, May 7, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Generated-code reference | Java - gRPC
Packages For each service defined in a .proto file, the Java code generation produces a Java class. The class name is the service's...
Read more >
gRPC 101 for Java Developers by Ray Tsang - YouTube
gRPC is a high performance, open source, general RPC framework that puts mobile and HTTP/2 first. gRPC is based on many years of...
Read more >
Supersonic, Subatomic gRPC services with Java and Quarkus
Get an overview of gRPC and how it compares to REST over HTTP, ... RMI in that they require generating and using client...
Read more >
Multiple clients connected to a single server gRPC-java
They should all connect to the server and execute the server side code. In case you are thinking of six long running persistent...
Read more >
How to Accelerate Microservices Development - Apriorit
A step-by-step guide to connecting gRPC microservices to GraphQL based on ... Then we use those proto files to create the GraphQL layer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found