-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grpc protobuff json support #1029
base: 4.9.x
Are you sure you want to change the base?
Grpc protobuff json support #1029
Conversation
will add tests shortly. got rid of javadoc nagging
… mapper could be a better implementation, but this one we replaced it with is the standard one that comes with google, so that's one less dependency leaving this implmentation to be pure micronaut and google.
… Saving to ask for assistance
creating a grpc service in groovy and cleaned up some check errors
…o get the controller to register when the system is starting. If we force the annotation scan this works, but we need to figure out how to automate that
…o get the controller to register when the system is starting. If we force the annotation scan this works, but we need to figure out how to automate that
…ted sample project for tutorial.
…r tests for all the classes.
Now if you annotate the grpc client you can get a client rest stub, too
…was the same logic to find these methods and invoke them, may as well do it for blocking services and async clients, too. Passes all the same tests successfully
…was the same logic to find these methods and invoke them, may as well do it for blocking services and async clients, too. Passes all the same tests successfully
I updated this to also support bean registration for grpc clients. Now if someone hands me a grpc service, the act of annotating that bean with @GrpcRestJsonExposed will allow the controller to register that bean for GRPC JSON serialization. Also added support for both async and blocking calls. I'm going to write a tutorial for these use cases.. but I think we're in pretty good shape as far as the use cases we test for this. I fell like it's fully featured now - I'll stop adding stuff to it now and see if you can review it. |
@graemerocher how's this look? |
gRPC JSON protocol buffer support
#1025 had a quick discussion on this, I found myself converting from JSON to Proto and back often - just so I can read the data a little easier. Since other debugging tools have built in serialization reading, and since a lot of data scientists I work with prefer JSON calls over gRPC.
Per discussion, this feature does the following:
For any grpc project in micronaut, if you annotate a service with @io.micronaut.grpc.annotation.GrpcRestJsonExposed then it will create endpoints based on the service definition and allow for a REST JSON endpoint to proxy grpc requests between JSON and gRPC.
This can be useful in testing situations or for exposing grpc services to front ends using basic HTTP1.1 communication.
This can also be used to quickly serialize between REST services or protocol buffer endpoints.
Finally, if you have this running, it's can be easier to test this via cURL.
This uses the google json parser and printer for the serialization.
Although the concept was simple, it required a lot of testing use cases, but let me know if I missed some use cases and I'll add more tests.
Additions