New Hystrix based Circuit Breaker EIP

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

New Hystrix based Circuit Breaker EIP

Claus Ibsen-2
Hi

We have a few attempts of a Circuit Breaker in Apache Camel

- Circuit Braker Load Balancer
- Hystrix Component

The former is a pure Camel implementation in camel-core that when the
circuit is open will reject processing.

The latter is a Camel component where you call an endpoint that then
does the CB.

However it would be great if we have a first class EIP that is a CB
that allows to plugin Hystrix.


So I started an attempt of that on a branch named hys:
https://github.com/apache/camel/tree/hys

So all you have to do is to use the new hystrixCircuitBreaker EIP (we
can rename later) in your route and then setup a fallback part, eg
just like a choice EIP works. Or maybe better think as a doTry ..
doCatch etc.

You can find two examples here

Success: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerOkTest.java

Fallback: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerFallbackTest.java


As an end user all you have to do is to add camel-hystrix to the
classpath (just like with camel-swagger-java does for api docs).

The EIP does not yet expose any configuration options for hystrix CB,
but you can configure a bunch of those, so we should allow some level
of configuration.


We should also make it possible to integrate this with the hystrix
dashboard, so you can see the state of all those from your Camel apps.
https://github.com/Netflix/Hystrix/tree/master/hystrix-dashboard











--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: New Hystrix based Circuit Breaker EIP

bibryam
Claus, are the example links correct, I get 404?

On 18 April 2016 at 17:24, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> We have a few attempts of a Circuit Breaker in Apache Camel
>
> - Circuit Braker Load Balancer
> - Hystrix Component
>
> The former is a pure Camel implementation in camel-core that when the
> circuit is open will reject processing.
>
> The latter is a Camel component where you call an endpoint that then
> does the CB.
>
> However it would be great if we have a first class EIP that is a CB
> that allows to plugin Hystrix.
>
>
> So I started an attempt of that on a branch named hys:
> https://github.com/apache/camel/tree/hys
>
> So all you have to do is to use the new hystrixCircuitBreaker EIP (we
> can rename later) in your route and then setup a fallback part, eg
> just like a choice EIP works. Or maybe better think as a doTry ..
> doCatch etc.
>
> You can find two examples here
>
> Success: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerOkTest.java
>
> Fallback: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerFallbackTest.java
>
>
> As an end user all you have to do is to add camel-hystrix to the
> classpath (just like with camel-swagger-java does for api docs).
>
> The EIP does not yet expose any configuration options for hystrix CB,
> but you can configure a bunch of those, so we should allow some level
> of configuration.
>
>
> We should also make it possible to integrate this with the hystrix
> dashboard, so you can see the state of all those from your Camel apps.
> https://github.com/Netflix/Hystrix/tree/master/hystrix-dashboard
>
>
>
>
>
>
>
>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



--
Bilgin Ibryam
Camel Committer at ASF & Integration Architect at Red Hat
Blog: http://ofbizian.com | Twitter: @bibryam

Camel Design Patterns https://leanpub.com/camel-design-patterns
Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475
Reply | Threaded
Open this post in threaded view
|

Re: New Hystrix based Circuit Breaker EIP

Claus Ibsen-2
Hi

The tests are here
https://github.com/apache/camel/tree/master/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor

On Tue, Apr 19, 2016 at 11:16 PM, Bilgin Ibryam <[hidden email]> wrote:

> Claus, are the example links correct, I get 404?
>
> On 18 April 2016 at 17:24, Claus Ibsen <[hidden email]> wrote:
>> Hi
>>
>> We have a few attempts of a Circuit Breaker in Apache Camel
>>
>> - Circuit Braker Load Balancer
>> - Hystrix Component
>>
>> The former is a pure Camel implementation in camel-core that when the
>> circuit is open will reject processing.
>>
>> The latter is a Camel component where you call an endpoint that then
>> does the CB.
>>
>> However it would be great if we have a first class EIP that is a CB
>> that allows to plugin Hystrix.
>>
>>
>> So I started an attempt of that on a branch named hys:
>> https://github.com/apache/camel/tree/hys
>>
>> So all you have to do is to use the new hystrixCircuitBreaker EIP (we
>> can rename later) in your route and then setup a fallback part, eg
>> just like a choice EIP works. Or maybe better think as a doTry ..
>> doCatch etc.
>>
>> You can find two examples here
>>
>> Success: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerOkTest.java
>>
>> Fallback: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerFallbackTest.java
>>
>>
>> As an end user all you have to do is to add camel-hystrix to the
>> classpath (just like with camel-swagger-java does for api docs).
>>
>> The EIP does not yet expose any configuration options for hystrix CB,
>> but you can configure a bunch of those, so we should allow some level
>> of configuration.
>>
>>
>> We should also make it possible to integrate this with the hystrix
>> dashboard, so you can see the state of all those from your Camel apps.
>> https://github.com/Netflix/Hystrix/tree/master/hystrix-dashboard
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>
>
>
> --
> Bilgin Ibryam
> Camel Committer at ASF & Integration Architect at Red Hat
> Blog: http://ofbizian.com | Twitter: @bibryam
>
> Camel Design Patterns https://leanpub.com/camel-design-patterns
> Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: New Hystrix based Circuit Breaker EIP

Claus Ibsen-2
Hi

The hystrix EIP is moved into the master branch.
I just added JMX support so you can get the hystrix health stats and
whatnot from JMX in the Camel processor tree.

The nice thing is that we can implement other EIPs in the future the
same way (eg also a bit like data format today) where we have the EIP
in the model in camel-core but have it actually implemented in the
component outside camel-core. And the end user should just remember to
add the camel-xx component to the classpath.


Integration with the dashboard requires to output those metrics in
turbine json format that the dashboard uses.

On Wed, Apr 20, 2016 at 6:26 AM, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> The tests are here
> https://github.com/apache/camel/tree/master/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/processor
>
> On Tue, Apr 19, 2016 at 11:16 PM, Bilgin Ibryam <[hidden email]> wrote:
>> Claus, are the example links correct, I get 404?
>>
>> On 18 April 2016 at 17:24, Claus Ibsen <[hidden email]> wrote:
>>> Hi
>>>
>>> We have a few attempts of a Circuit Breaker in Apache Camel
>>>
>>> - Circuit Braker Load Balancer
>>> - Hystrix Component
>>>
>>> The former is a pure Camel implementation in camel-core that when the
>>> circuit is open will reject processing.
>>>
>>> The latter is a Camel component where you call an endpoint that then
>>> does the CB.
>>>
>>> However it would be great if we have a first class EIP that is a CB
>>> that allows to plugin Hystrix.
>>>
>>>
>>> So I started an attempt of that on a branch named hys:
>>> https://github.com/apache/camel/tree/hys
>>>
>>> So all you have to do is to use the new hystrixCircuitBreaker EIP (we
>>> can rename later) in your route and then setup a fallback part, eg
>>> just like a choice EIP works. Or maybe better think as a doTry ..
>>> doCatch etc.
>>>
>>> You can find two examples here
>>>
>>> Success: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerOkTest.java
>>>
>>> Fallback: https://github.com/apache/camel/blob/hys/components/camel-hystrix/src/test/java/org/apache/camel/component/hystrix/HystrixCircuitBreakerFallbackTest.java
>>>
>>>
>>> As an end user all you have to do is to add camel-hystrix to the
>>> classpath (just like with camel-swagger-java does for api docs).
>>>
>>> The EIP does not yet expose any configuration options for hystrix CB,
>>> but you can configure a bunch of those, so we should allow some level
>>> of configuration.
>>>
>>>
>>> We should also make it possible to integrate this with the hystrix
>>> dashboard, so you can see the state of all those from your Camel apps.
>>> https://github.com/Netflix/Hystrix/tree/master/hystrix-dashboard
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>>
>>
>> --
>> Bilgin Ibryam
>> Camel Committer at ASF & Integration Architect at Red Hat
>> Blog: http://ofbizian.com | Twitter: @bibryam
>>
>> Camel Design Patterns https://leanpub.com/camel-design-patterns
>> Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

AW: New Hystrix based Circuit Breaker EIP

Jan Matèrne (jhm)
> The nice thing is that we can implement other EIPs in the future the
> same way (eg also a bit like data format today) where we have the EIP
> in the model in camel-core but have it actually implemented in the
> component outside camel-core. And the end user should just remember to
> add the camel-xx component to the classpath.

I like the idea of adding the implementation in such a way.
Does the component just implement that one EIP?
Otherwise: which component is used when multiple implementations are on the classpath?

Jan

Reply | Threaded
Open this post in threaded view
|

Re: New Hystrix based Circuit Breaker EIP

Claus Ibsen-2
On Thu, Apr 21, 2016 at 7:16 AM, Jan Matèrne (jhm) <[hidden email]> wrote:

>> The nice thing is that we can implement other EIPs in the future the
>> same way (eg also a bit like data format today) where we have the EIP
>> in the model in camel-core but have it actually implemented in the
>> component outside camel-core. And the end user should just remember to
>> add the camel-xx component to the classpath.
>
> I like the idea of adding the implementation in such a way.
> Does the component just implement that one EIP?
> Otherwise: which component is used when multiple implementations are on the classpath?
>

Yes only that EIP. There is a marker file in the camel-hystrix that
tells Camel that it implement the given EIP model.
https://github.com/apache/camel/tree/master/components/camel-hystrix/src/main/resources/META-INF/services/org/apache/camel/model


> Jan
>



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

AW: New Hystrix based Circuit Breaker EIP

Jan Matèrne (jhm)
> > I like the idea of adding the implementation in such a way.
> > Does the component just implement that one EIP?
> > Otherwise: which component is used when multiple implementations are
> on the classpath?
> >
>
> Yes only that EIP. There is a marker file in the camel-hystrix that
> tells Camel that it implement the given EIP model.
> https://github.com/apache/camel/tree/master/components/camel-
> hystrix/src/main/resources/META-INF/services/org/apache/camel/model

What will happen if there are multiple jars with such a marker file?
Or do playing devils advocate? ;)

Jan


Reply | Threaded
Open this post in threaded view
|

Re: New Hystrix based Circuit Breaker EIP

Claus Ibsen-2
On Thu, Apr 21, 2016 at 11:00 AM, Jan Matèrne (jhm) <[hidden email]> wrote:

>> > I like the idea of adding the implementation in such a way.
>> > Does the component just implement that one EIP?
>> > Otherwise: which component is used when multiple implementations are
>> on the classpath?
>> >
>>
>> Yes only that EIP. There is a marker file in the camel-hystrix that
>> tells Camel that it implement the given EIP model.
>> https://github.com/apache/camel/tree/master/components/camel-
>> hystrix/src/main/resources/META-INF/services/org/apache/camel/model
>
> What will happen if there are multiple jars with such a marker file?
> Or do playing devils advocate? ;)
>

Yes you are there is only one. But the finder in camel-core could
detect duplicates and warn / fail or whatever.

> Jan
>
>



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2