org.apache.camel.model.CircuitBreakerDefinition Java Examples
The following examples show how to use
org.apache.camel.model.CircuitBreakerDefinition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HystrixProcessor.java From camel-quarkus with Apache License 2.0 | 5 votes |
@BuildStep void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, BuildProducer<NativeImageSystemPropertyBuildItem> systemProperty) { reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, HystrixConfigurationCommon.class, HystrixConfigurationDefinition.class, CircuitBreakerDefinition.class, OnFallbackDefinition.class)); // Force RxJava to not use Unsafe API systemProperty.produce(new NativeImageSystemPropertyBuildItem("rx.unsafe-disable", "true")); }
Example #2
Source File: HystrixHierarchicalConfigurationTest.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Test public void testConfiguration() throws Exception { RouteDefinition routeDefinition = camelContext.getExtension(Model.class).getRouteDefinition("hystrix-route"); CircuitBreakerDefinition hystrixDefinition = findCircuitBreaker(routeDefinition); Assert.assertNotNull(hystrixDefinition); Route rc = new DefaultRoute(camelContext, null, null, null, null); HystrixReifier reifier = new HystrixReifier(rc, hystrixDefinition); HystrixConfigurationDefinition config = reifier.buildHystrixConfiguration(); Assert.assertEquals("local-conf-group-key", config.getGroupKey()); Assert.assertEquals("global-thread-key", config.getThreadPoolKey()); Assert.assertEquals("5", config.getCorePoolSize()); }
Example #3
Source File: HystrixHierarchicalConfigurationTest.java From camel-spring-boot with Apache License 2.0 | 5 votes |
private CircuitBreakerDefinition findCircuitBreaker(RouteDefinition routeDefinition) throws Exception { return routeDefinition.getOutputs().stream() .filter(CircuitBreakerDefinition.class::isInstance) .map(CircuitBreakerDefinition.class::cast) .findFirst() .orElseThrow(() -> new IllegalStateException("Unable to find a CircuitBreakerDefinition")); }