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

hystrix rx-java incompatibility with mvc controllers #972

Closed
gadams00 opened this issue Apr 15, 2016 · 1 comment
Closed

hystrix rx-java incompatibility with mvc controllers #972

gadams00 opened this issue Apr 15, 2016 · 1 comment
Labels

Comments

@gadams00
Copy link
Contributor

gadams00 commented Apr 15, 2016

Before Brixton.RC1, we had ObservableReturnValueHandler. That apparently has been dropped in favor of SingleReturnValueHandler, which IMO makes a lot of sense. Naturally, I switched over to Single, but then found that hystrix doesn't work with Single (Netflix/Hystrix#1088). I'm getting

com.netflix.hystrix.contrib.javanica.exception.FallbackDefinitionException: Incompatible return types. Command method: public rx.Single com.build.coordination.order.OrderServiceImpl.getCustomerOrders(int), fallback method: public java.util.List com.build.coordination.order.OrderServiceImpl.getCustomerOrdersFallback(int). Hint: 
    at com.netflix.hystrix.contrib.javanica.utils.FallbackMethod.validateReturnType(FallbackMethod.java:132) ~[hystrix-javanica-1.5.2.jar:1.5.2]
    at com.netflix.hystrix.contrib.javanica.utils.FallbackMethod.validateReturnType(FallbackMethod.java:111) ~[hystrix-javanica-1.5.2.jar:1.5.2]
    at com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect$MetaHolderFactory.metaHolderBuilder(HystrixCommandAspect.java:122) ~[hystrix-javanica-1.5.2.jar:1.5.2]

where I use @HystrixCommand and return an rx.java.Single. This applies to both Brixton.RC1 and Brixton.BUILD-SNAPSHOT. The only workaround is to use Observable here and convert to single before I return from my controller via Observable.toSingle(). That's quite a nasty thing to require. Is there going to be some solution for this before Brixton goes GA?

@spencergibb
Copy link
Member

I think you hit the nail on the head. We moved from Observable to Single because the framework can't know if your Observable emits just one value or multiple. Until Hystrix supports Single, I'm afraid your workaround is the only thing to do.

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

No branches or pull requests

3 participants