org.apache.camel.component.seda.SedaComponent Java Examples
The following examples show how to use
org.apache.camel.component.seda.SedaComponent.
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: PropertiesTest.java From camel-k-runtime with Apache License 2.0 | 6 votes |
@Test public void testComponentConfiguration() throws Exception { int queueSize1 = ThreadLocalRandom.current().nextInt(10, 100); int queueSize2 = ThreadLocalRandom.current().nextInt(10, 100); Properties properties = new Properties(); properties.setProperty("camel.component.seda.queueSize", Integer.toString(queueSize1)); properties.setProperty("camel.component.my-seda.queueSize", Integer.toString(queueSize2)); ApplicationRuntime runtime = new ApplicationRuntime(); runtime.setProperties(properties); runtime.getRegistry().bind("my-seda", new SedaComponent()); runtime.addListener(new ContextConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { CamelContext context = r.getCamelContext(); assertThat(context.getComponent("seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize1); assertThat(context.getComponent("my-seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize2); runtime.stop(); }); runtime.run(); }
Example #2
Source File: PropertiesNameFormatsTest.java From camel-kafka-connector with Apache License 2.0 | 5 votes |
@Test public void testCamelCaseFormat() { Map<String, String> props = new HashMap<>(); props.put("camel.source.url", "seda://test"); props.put("topics", "mytopic"); props.put("camel.component.seda.defaultQueueFactory", "#class:org.apache.camel.kafkaconnector.test.TestBlockingQueueFactory"); props.put("camel.component.seda.defaultQueueFactory.counter", "1"); CamelSourceTask camelsourceTask = new CamelSourceTask(); camelsourceTask.start(props); BlockingQueueFactory<Exchange> sedaTestQueue = ((SedaComponent) camelsourceTask.getCms().getEndpoint("seda://test").getCamelContext().getComponent("seda")).getDefaultQueueFactory(); assertEquals("org.apache.camel.kafkaconnector.test.TestBlockingQueueFactory", sedaTestQueue.getClass().getName()); assertEquals(1, ((TestBlockingQueueFactory)sedaTestQueue).getCounter()); camelsourceTask.stop(); }
Example #3
Source File: PropertiesNameFormatsTest.java From camel-kafka-connector with Apache License 2.0 | 5 votes |
@Test public void testDashSeparatedFormat() { Map<String, String> props = new HashMap<>(); props.put("camel.source.url", "seda://test"); props.put("topics", "mytopic"); props.put("camel.component.seda.default-queue-factory", "#class:org.apache.camel.kafkaconnector.test.TestBlockingQueueFactory"); props.put("camel.component.seda.default-queue-factory.counter", "1"); CamelSourceTask camelsourceTask = new CamelSourceTask(); camelsourceTask.start(props); BlockingQueueFactory<Exchange> sedaTestQueue = ((SedaComponent) camelsourceTask.getCms().getEndpoint("seda://test").getCamelContext().getComponent("seda")).getDefaultQueueFactory(); assertEquals("org.apache.camel.kafkaconnector.test.TestBlockingQueueFactory", sedaTestQueue.getClass().getName()); assertEquals(1, ((TestBlockingQueueFactory)sedaTestQueue).getCounter()); camelsourceTask.stop(); }
Example #4
Source File: SedaComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "seda-component") @ConditionalOnMissingBean(SedaComponent.class) public SedaComponent configureSedaComponent() throws Exception { SedaComponent component = new SedaComponent(); component.setCamelContext(camelContext); Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, component, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (ComponentCustomizer<SedaComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.seda.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.seda.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #5
Source File: IntegrationTest.java From camel-k-runtime with Apache License 2.0 | 5 votes |
@Test public void testComponentConfiguration() { configureRoutes( "classpath:routes-with-component-configuration.js" ); SedaComponent seda = context.getComponent("seda", SedaComponent.class); assertThat(seda).isNotNull(); assertThat(seda).hasFieldOrPropertyWithValue("queueSize", 1234); }
Example #6
Source File: CustomCamelContextConfigTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override public CamelContext createCamelContext() { CamelContext context = new DefaultCamelContext(); // plug in a seda component, as we don't really need an embedded broker context.addComponent("activemq", new SedaComponent()); return context; }