Hystrix with Scala

1,214 views
Skip to first unread message

Markus Lachinger

unread,
Oct 31, 2013, 3:47:48 PM10/31/13
to hystr...@googlegroups.com
Is anyone using Hystrix with Scala. If so, how?

I am thinking of creating something similar to hystrix-clj. What would the best approach to this be?
What features should the scala version have?

The main feature I am thinking of would be to use Scala Futures instead of Observables and Java Futures.

Then, what makes more sense: Wrapper vs. overloading/rewriting the current HystrixCommand class with Scala specific methods?


Thanks,
Markus

Ben Christensen

unread,
Oct 31, 2013, 3:54:33 PM10/31/13
to Markus Lachinger, hystr...@googlegroups.com
Sounds great Markus, two suggestions as you go down this path.

1) The observe() method can still be consumed as Observable from Scala with the RxJava-Scala project: https://github.com/Netflix/RxJava/tree/master/language-adaptors/rxjava-scala

2) The queue() method returning Future should be completely replaced by a Scala Future equivalent than uses observe() under the covers to get a callback to the Scala Future since Scala Futures support composition and callbacks. The Observable -> Scala Future bridge would retain the non-blocking behavior.

3) You may want to consider the RxJava-Scala approach of wrapping with a value class: https://github.com/Netflix/RxJava/blob/master/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Observable.scala#L73


Good luck!

-- 
Ben Christensen
+1.310.782.5511 @benjchristensen
--
You received this message because you are subscribed to the Google Groups "HystrixOSS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hystrixoss+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ben Christensen

unread,
Oct 31, 2013, 3:57:57 PM10/31/13
to Markus Lachinger, hystr...@googlegroups.com
So it ended up being three :-)

... two suggestions as you go down this path ...

Pablo Fernandez

unread,
Nov 19, 2013, 2:29:05 PM11/19/13
to hystr...@googlegroups.com, Markus Lachinger
Just heard about hystrix on this year's AWS re:Invent. My question is: Isn't the Futures + Promises on scala.concurrent.* powerful enough? Why add a framework on top of that?

Ben Christensen

unread,
Nov 19, 2013, 10:43:10 PM11/19/13
to Pablo Fernandez, hystr...@googlegroups.com, Markus Lachinger
Hystrix is not about Futures and Promises, it is about bulk-heading and isolating dependencies by limiting concurrent execution, circuit breakers, real time monitoring and metrics. Futures are just a mechanism by which async execution is exposed. Futures by themselves do not provide the same degree of fault-tolerance functionality (though parts of it can be achieved with careful use of timeouts and thread-pool sizing). You could think of Hystrix as a hardened extension of a Future.


-- 
Ben Christensen
+1.310.782.5511  @benjchristensen

--
Reply all
Reply to author
Forward
0 new messages