Allow to use Reactor Flux or RxJava Observable instead of gRPC StreamObserver
Allow to use Reactive types like Reactor Flux or RxJava Observable instead of dealing direction with gRPC StreamObserver would be awesome for the end user, and since gRPC supports Backpressure that would be a very good match.
Integration with single value types like Reactor Mono or RxJava Single would also be really useful.
Maybe @saturnism has some ideas about how to achieve this since this is one of the topic or his upcoming Spring I/O talk ...
One possible solution would be to have protoc generator plugin that will wrap all generated interfaces with Observable instead of StreamObserver. There is already one that does this to bridge rest api with grpc.
@sdeleuze ,what is your opinion about this approach ?
I'm totally in favour of using Reactor types instead of native gRPC types. But, I would question that this is the responsibility of a spring-boot-starter.
Indeed, that's maybe out of the scope of this starter, that would make more sense if available as a distinct artifact. I have no time to develop that myself, but @smaldini and I could provide some guidance if a contributor is interested.
I would be interested in hearing your opinion about having protoc plugin proposed earlier in this thread
As @sdeleuze said, make it a separate artifact then, and don't mix it with the spring-boot-starter.
I totally understand that the bridge would be the separate artifact, I'm trying to do a brainstorming to accomplish the solution. My proposal is to implement protoc plugin that will generate the abstract implementation of gRPC interfaces with Reactive types, then the end user can decide which API he is more comfortable with and for using reactive types he will add protoc plugin in his gradle/maven build. I want to understand the concept of solution that @sdeleuze has in mind.
:+1:
See https://github.com/salesforce/grpc-java-contrib/pull/17 for a rxjava2 integration passing the rx stream TCK. Could be a good base for a Reactor implementation.
@cbornet ,Looks great, thanks for sharing. Which functionality/features this starter should include in addition to samples of Rx java usage based on saleforce protoc plugin ?
great stuff @cbornet would love to see how we can plug in the lite cousin of rx especially for direct interop with spring fmk 5/spring boot 2
Yes, I'm not sure there's anything to do for RxJava/Reactor in this project. I've tested and salesforce plugin + this starter works out-of-the-box. So the Reactor plugin should probably be done in another project.
I think this issue can be closed as @cbornet is already working on this feature in https://github.com/cbornet/grpc-java-contrib/tree/reactor , tracked in https://github.com/salesforce/reactive-grpc/issues/6
@cbornet so you're using grpc-spring-boot-starter together with https://github.com/salesforce/reactive-grpc/issues/6 ?
Isn't their impl built on (along with) separate generated 'reactor' Grpc services, + defining their own custom @GrpcService?
@hartmut-co-uk yes I confirm they work perfectly together. The custom @GrpcService is in another salesforce lib.
@cbornet 👍 thanks - will have another look! :-)
almost forgot to update.. works like a charm!
does this still apply today? is there a sample project that's available that shows this integration between the grpc-spring-boot-starter and reactive-grpc?
@dalegaspi https://github.com/salesforce/reactive-grpc
@jvmlet i downloaded and searched the entire repo none of the demos (or anything for that matter) references the grpc-spring-boot-starter in the pom.xml file(s). should i be looking for something else entirely?
Edit: so the reactive-grpc stuff creates the Reactive stub methods(s) and it just works from the looks of it.
https://github.com/salesforce/reactive-grpc/tree/master/demos/hello-world. Have a look at protoc plugin this project uses in pom file. The server side implementation is not tied to any specific helper, including this starter, as long as it properly binds to grpc api. As it was mentioned above, you can implement the server using this starter (which makes your life easier) and benefit both from spring and rx technologies.