Try add methods like this in the route builder class
@Bean("fallback")
Endpoint fallbackEndpoint(CamelContext context) {
return context.getEndpoint("xxxx");
}
On Fri, Apr 8, 2016 at 6:08 PM, kumar5 <[email protected]> wrote:
> thanks
> i am using camel-hystrix 2.18.0 code which is not release at but i
> requirement to use it.
> i was using as given in test case but i am getting error :Caused by:
> java.lang.IllegalStateException: Another strategy was already registered.
>
> @Bean
> RouteBuilder createRouteBuilder() {
> return new RouteBuilder() {
>
> @Override
> public void configure() {
> CamelContext context = getContext();
> SimpleRegistry registry = new SimpleRegistry();
>
> context = new DefaultCamelContext(registry);
> registry.put("run", context.getEndpoint("direct:run"));
> registry.put("fallback",
> context.getEndpoint("direct:fallback"));
> registry.put("headerExpression",
> ExpressionBuilder.headerExpression("key"));
> from("direct:fallback")
> .log("======================== fallback")
> .to("mock:error");
>
> from("direct:run")
> .process(new Processor() {
> @Override
> public void process(Exchange exchange) throws
> Exception {
> Thread.sleep(500); //a slow operation
> }
> })
> .log("======================== this is run")
> .to("mock:result");
>
> from("direct:MainRouteStart")
>
> .to("hystrix:testKey?runEndpointId=direct:run&fallbackEndpointId=direct:fallback&executionTimeoutInMilliseconds=100");
> }
> };
> }
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-2-16-2-spring-and-java-DSL-register-tp5780772p5780782.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2