Skip to content
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

Support @HystrixCommand for rx.Single and rx.Completable similar to rx.Observable #1403

Closed
piotrturski opened this issue Oct 24, 2016 · 9 comments

Comments

@piotrturski
Copy link

piotrturski commented Oct 24, 2016

@HystrixCommand doesn't work as expected for methods that return rx.Single or rx.Completable. it would be nice to have them handled in a same way as rx.Observable

@piotrturski piotrturski changed the title Support for rx.Single and rx.Completable similar to rx.Observable Support @HystrixCommand for rx.Single and rx.Completable similar to rx.Observable Oct 24, 2016
@mattrjacobs
Copy link
Contributor

I think this could get addressed at the hystrix-core or hystrix-javanica layer. I'm happy to review PRs for either, if anyone is interested in this.

@piotrturski
Copy link
Author

i'm willing to try if someone can point me to classes that do that for Observable, so i can understand the architecture

@mattrjacobs
Copy link
Contributor

In Javanica, the support is here: https://github.com/Netflix/Hystrix/blob/master/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericObservableCommand.java.

In hystrix-core, the class is here: https://github.com/Netflix/Hystrix/blob/master/hystrix-core/src/main/java/com/netflix/hystrix/HystrixObservableCommand.java.

If you're interested in working on the extension to hystrix-core, please let me know, so I can help with design considerations. Thanks!

@piotrturski
Copy link
Author

of course i'm open to suggestions. after a quick look at the code, i was thinking about adding .toSingle() and .toCompletable() somewhere in HystrixCommandAspect or create new ExecutionTypes. it would be perfect to just add some post-processing to existing observableCommand, but yet i don't see any quick way of doing it

@dmgcodevil
Copy link
Contributor

dmgcodevil commented Feb 21, 2017

@piotrturski If it's still relevant, I believe that first of all hystrix-core should be extended to support Completable , Single and etc. Currently it's not possible to implement it using HystrixObservableCommand because HystrixObservableCommand#construct returns Observable, but Completable and Observable are different types. However, possible workaround is to add a logic to transform incompatible rx types once command action executed and before passing a result to a caller. I have made some changes and pushed to my branch. Checkout out my changes by the following commit.

@pmendelski
Copy link

Hi, I stuck on the same problem - HystrixCommand with rx.Single. @dmgcodevil did you think about making a PR from your branch?

@dmgcodevil
Copy link
Contributor

dmgcodevil commented Mar 25, 2017

@mendlik basically I can, however I'm not sure whether this implementation makes sense from reactive programming perspective, could you review my commit ?

@pmendelski
Copy link

@dmgcodevil thanks for staying on this issue. I read your code and it looks ok to me. IMHO it's ready to become a PR.

I also agree with your comment #1403 (comment) . It would be nice to make hystrix-core extendible for all kinds of reactive streams. But in the meantime your PR will make hystrix support for RxJava close to complete. Thanks.

@dmgcodevil
Copy link
Contributor

dmgcodevil commented Jun 15, 2017

@mattrjacobs This issue can be close since PR is closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants