Change the hystrix configuration dynamically (per instance)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Change the hystrix configuration dynamically (per instance)

This post was updated on .

I'm working on a large integration project based on the apache camel 2.22.0
and tomcat 7 as web container.
I would like to set up a route to handle HTTP dynamic routing (32
endpoints) with Hystrix EIP as a resiliency solution. However, I
encountered a problem with updating the hystrix settings in the runtime,
when i wanted to override the GroupKey/ThreadPoolKey  parameters
depending on the instance.

Note that when the hystrix circuit breaker is open, it remains open
regardless of the instance (endpoint) that is called.

So, is there any way to update hystrix configuration at runtime in a single
camel route ? I'm using Spring XML DSL to create a route and referring to a
hystrix configuration.

For now the only solution I have is to do one hystrix route per endpoint
but that makes a lot of routes that do the same thing.

Below my test example

Thank you for your help!

Best regards
<beans:bean id="hystrixConfiguration"
<beans:property name="circuitBreakerSleepWindowInMilliseconds"
value="10000" />
<beans:property name="circuitBreakerRequestVolumeThreshold" value="3" />
<beans:property name="circuitBreakerErrorThresholdPercentage" value="50" />
<beans:property name="groupKey" value="myGroup" />

<route id="timerClient" streamCache="true">
<from uri="timer:trigger?period=1000&amp;fixedRate=true&amp;repeatCount=50"
<setHeader headerName="endpointsToBeTriggered">
<method beanType="camel.hystrix.MessageRouter"
method="getEndpointsToRouteMessageTo" />
<to uri="direct:toHystrix" />

<route id="toHystrix">
<from uri="direct:toHystrix" />
<hystrix id="toHystrixEip" hystrixConfigurationRef="hystrixConfiguration">
<toD uri="${headers.endpointsToBeTriggered}" />
<simple>Hystrix Fallback message</simple>