salesforce / grpc-java-contrib

Useful extensions for the grpc-java library
BSD 3-Clause "New" or "Revised" License
220 stars 34 forks source link

Move non RxJava stub classes to an independent artifact #60

Closed cbornet closed 6 years ago

cbornet commented 6 years ago

Working on porting rxgrpc to Spring's Reactor, I realized that some of the rxgrpc classes don't depend on RxJava and could be mutualized between all reactive-streams implementations (RxJava, Reactor, Akka-streams, ...) Those are : CancellableStreamObserver, RxExecutor, RxStreamBackpressureOnReadyHandler, RxStreamObserverPublisher Maybe some others could also be generified.

So it would be great to have these in an artifact independant of the underlying reactive implementation.

cbornet commented 6 years ago

The generator could also have a common mother class + mustache file as the diff between implementations would be mostly an import and maybe the class/method prefix.

rmichela commented 6 years ago

Maybe some others could also be generified.

Perhaps. Do you have a working POC using these classes? I'm hesitant to move these classes prematurely since they weren't written with other reactive technologies in mind.

If POC work with other reactive technologies shows they can be used with no or minimal modification, we could move them up into a contrib/reactive namespace under grpc-java-contrib.

cbornet commented 6 years ago

My Reactor port is in good way : I have everything working except the TCK. I copied the classes above as-is without modification so it would be great to have them in contrib/reactive.

As for the Reactor gen, do you prefer that I PR on this repo or that I maintain it in another one (most of the code is yours, I only did a portage) ?

cbornet commented 6 years ago

See my branch here. I now have everything working (the changes for the TCK were very straight-forward).

rmichela commented 6 years ago

This looks great! I was thinking of splitting the rx packages off from the contrib stuff into its own repo, since they change at different rates and for different reasons. Also, the rx tests take so long to validate everything.

A proposed layout would look like:

What do you think?

cbornet commented 6 years ago

👍 I let you create it. Just give me credit for the reactor part 😄

cbornet commented 6 years ago

@rmichela Do you need help on this ? If you create the repo, I can do PRs.

rmichela commented 6 years ago

I'm working on creating the repo now. (Process and all) It should be up in a day or so.

rmichela commented 6 years ago

@cbornet I've created the new repo and set you up as a collaborator. You can now move your code and do the refactoring you need to get a common base module.

cbornet commented 6 years ago

:+1:

rmichela commented 6 years ago

RxGrpc can now be found at https://github.com/salesforce/reactive-grpc. Continued work on this issue will happen there.