Search in sources :

Example 11 with HystrixConfigurationDefinition

use of org.apache.camel.model.HystrixConfigurationDefinition in project camel by apache.

the class SpringHystrixRouteHierarchicalConfigTest method testHystrix.

@Test
public void testHystrix() throws Exception {
    RouteDefinition routeDefinition = context.getRouteDefinition("hystrix-route");
    HystrixDefinition hystrixDefinition = findHystrixDefinition(routeDefinition);
    Assert.assertNotNull(hystrixDefinition);
    HystrixProcessorFactory factory = new HystrixProcessorFactory();
    HystrixConfigurationDefinition config = factory.buildHystrixConfiguration(context, hystrixDefinition);
    Assert.assertEquals("local-conf-group-key", config.getGroupKey());
    Assert.assertEquals("global-thread-key", config.getThreadPoolKey());
    Assert.assertEquals(new Integer(5), config.getCorePoolSize());
    getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
    template.sendBody("direct:start", "Hello World");
    assertMockEndpointsSatisfied();
}
Also used : RouteDefinition(org.apache.camel.model.RouteDefinition) HystrixDefinition(org.apache.camel.model.HystrixDefinition) HystrixConfigurationDefinition(org.apache.camel.model.HystrixConfigurationDefinition) Test(org.junit.Test)

Aggregations

HystrixConfigurationDefinition (org.apache.camel.model.HystrixConfigurationDefinition)11 HystrixDefinition (org.apache.camel.model.HystrixDefinition)7 Test (org.junit.Test)7 RouteDefinition (org.apache.camel.model.RouteDefinition)4 HashMap (java.util.HashMap)3 CamelContext (org.apache.camel.CamelContext)3 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)3 RouteBuilder (org.apache.camel.builder.RouteBuilder)2 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)2 HystrixCommand (com.netflix.hystrix.HystrixCommand)1 HystrixCommandGroupKey (com.netflix.hystrix.HystrixCommandGroupKey)1 HystrixCommandKey (com.netflix.hystrix.HystrixCommandKey)1 HystrixCommandProperties (com.netflix.hystrix.HystrixCommandProperties)1 HystrixThreadPoolKey (com.netflix.hystrix.HystrixThreadPoolKey)1 HystrixThreadPoolProperties (com.netflix.hystrix.HystrixThreadPoolProperties)1 Map (java.util.Map)1 PostConstruct (javax.annotation.PostConstruct)1 Processor (org.apache.camel.Processor)1 HystrixConfigurationCommon (org.apache.camel.model.HystrixConfigurationCommon)1 BeansException (org.springframework.beans.BeansException)1