org.apache.camel.impl.SimpleRegistry Java Examples
The following examples show how to use
org.apache.camel.impl.SimpleRegistry.
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: SimpleRegistryTest.java From camelinaction2 with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { // create the registry to be the SimpleRegistry which is just a Map based implementation SimpleRegistry registry = new SimpleRegistry(); // register our HelloBean under the name helloBean registry.put("helloBean", new HelloBean()); // tell Camel to use our SimpleRegistry context = new DefaultCamelContext(registry); // create a producer template to use for testing template = context.createProducerTemplate(); // add the route using an inlined RouteBuilder context.addRoutes(new RouteBuilder() { public void configure() throws Exception { from("direct:hello").bean("helloBean", "hello"); } }); // star Camel context.start(); }
Example #2
Source File: CamelSqlTest.java From jbpm-work-items with Apache License 2.0 | 6 votes |
@Before public void setup() throws Exception { DeleteDbFiles.execute("~", "jbpm-db-test", true); setupDb(); context = setupWithPoolingDataSource("org.jbpm.contrib.camel-workitem"); SimpleRegistry simpleRegistry = new SimpleRegistry(); simpleRegistry.put("jdbc/testDS1", context.get(DATASOURCE)); handler = new SQLCamelWorkitemHandler("queryResult", new DefaultCamelContext(simpleRegistry)); }
Example #3
Source File: SimpleRegistryTest.java From camelinaction with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { // create the registry to be the SimpleRegistry which is just a Map based implementation SimpleRegistry registry = new SimpleRegistry(); // register our HelloBean under the name helloBean registry.put("helloBean", new HelloBean()); // tell Camel to use our SimpleRegistry context = new DefaultCamelContext(registry); // create a producer template to use for testing template = context.createProducerTemplate(); // add the route using an inlined RouteBuilder context.addRoutes(new RouteBuilder() { public void configure() throws Exception { from("direct:hello").beanRef("helloBean"); } }); // star Camel context.start(); }
Example #4
Source File: SignaturesDynamicTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { final String keyStorePassword = "keystorePassword"; final String trustStorePassword = "truststorePassword"; SimpleRegistry registry = new SimpleRegistry(); KeyStore keyStore = KeyStore.getInstance("JKS"); // Java keystore ClassLoader classLoader = getClass().getClassLoader(); log.info("Loading keystore from [{}]", classLoader.getResource("keystore.jks").toString()); keyStore.load(classLoader.getResourceAsStream("keystore.jks"), keyStorePassword.toCharArray()); registry.put("keyStore", keyStore); KeyStore trustStore = KeyStore.getInstance("JKS"); // Java keystore trustStore.load(classLoader.getResourceAsStream("truststore.jks"), trustStorePassword.toCharArray()); registry.put("trustStore", trustStore); return new DefaultCamelContext(registry); }
Example #5
Source File: SlowlyTransformingRouteLoadTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { final int testBatchSize = 1000; InputDataSet inputDataSet = new InputDataSet(); inputDataSet.setSize(testBatchSize); ExpectedOutputDataSet expectedOutputDataSet = new ExpectedOutputDataSet(); expectedOutputDataSet.setSize(testBatchSize); SimpleRegistry registry = new SimpleRegistry(); registry.put("input", inputDataSet); registry.put("expectedOutput", expectedOutputDataSet); return new DefaultCamelContext(registry); }
Example #6
Source File: SignaturesTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { final String keyStorePassword = "keystorePassword"; final String trustStorePassword = "truststorePassword"; SimpleRegistry registry = new SimpleRegistry(); KeyStore keyStore = KeyStore.getInstance("JKS"); // Java keystore ClassLoader classLoader = getClass().getClassLoader(); log.info("Loading keystore from [{}]", classLoader.getResource("keystore.jks").toString()); keyStore.load(classLoader.getResourceAsStream("keystore.jks"), keyStorePassword.toCharArray()); registry.put("keyStore", keyStore); KeyStore trustStore = KeyStore.getInstance("JKS"); // Java keystore trustStore.load(classLoader.getResourceAsStream("truststore.jks"), trustStorePassword.toCharArray()); registry.put("trustStore", trustStore); return new DefaultCamelContext(registry); }
Example #7
Source File: TransactionPolicyTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); dataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql"); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource); registry.put("transactionManager", transactionManager); SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy(); propagationRequired.setTransactionManager(transactionManager); propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", propagationRequired); auditLogDao = new AuditLogDao(dataSource); messageDao = new MessageDao(dataSource); CamelContext camelContext = new DefaultCamelContext(registry); SqlComponent sqlComponent = new SqlComponent(); sqlComponent.setDataSource(dataSource); camelContext.addComponent("sql", sqlComponent); return camelContext; }
Example #8
Source File: JmsTransactionTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL(broker.getTcpConnectorUri()); registry.put("connectionFactory", connectionFactory); JmsTransactionManager jmsTransactionManager = new JmsTransactionManager(); jmsTransactionManager.setConnectionFactory(connectionFactory); registry.put("jmsTransactionManager", jmsTransactionManager); SpringTransactionPolicy policy = new SpringTransactionPolicy(); policy.setTransactionManager(jmsTransactionManager); policy.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", policy); CamelContext camelContext = new DefaultCamelContext(registry); ActiveMQComponent activeMQComponent = new ActiveMQComponent(); activeMQComponent.setConnectionFactory(connectionFactory); activeMQComponent.setTransactionManager(jmsTransactionManager); camelContext.addComponent("jms", activeMQComponent); return camelContext; }
Example #9
Source File: SimpleCamelApplication.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { SimpleRegistry registry = new SimpleRegistry(); // add POJOs to the registry here using registry.put("name", <object reference>) CamelContext context = new DefaultCamelContext(registry); context.addComponent("mylogger", new LogComponent()); context.addRoutes(new LogMessageOnTimerEventRoute()); context.start(); // let the Camel runtime do its job for 5 seconds Thread.sleep(5000); // shutdown context.stop(); }
Example #10
Source File: RollbackMarkRollbackOnlyTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); DataSource auditDataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql"); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(auditDataSource); registry.put("transactionManager", transactionManager); SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy(); propagationRequired.setTransactionManager(transactionManager); propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", propagationRequired); auditLogDao = new AuditLogDao(auditDataSource); CamelContext camelContext = new DefaultCamelContext(registry); SqlComponent sqlComponent = new SqlComponent(); sqlComponent.setDataSource(auditDataSource); camelContext.addComponent("sql", sqlComponent); return camelContext; }
Example #11
Source File: RollbackTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); DataSource auditDataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql"); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(auditDataSource); registry.put("transactionManager", transactionManager); SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy(); propagationRequired.setTransactionManager(transactionManager); propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", propagationRequired); auditLogDao = new AuditLogDao(auditDataSource); CamelContext camelContext = new DefaultCamelContext(registry); SqlComponent sqlComponent = new SqlComponent(); sqlComponent.setDataSource(auditDataSource); camelContext.addComponent("sql", sqlComponent); return camelContext; }
Example #12
Source File: DatabaseTransactionTest.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); auditDataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql"); //registry.put("auditDataSource", auditDataSource); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(auditDataSource); registry.put("transactionManager", transactionManager); SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy(); propagationRequired.setTransactionManager(transactionManager); propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", propagationRequired); auditLogDao = new AuditLogDao(auditDataSource); CamelContext camelContext = new DefaultCamelContext(registry); SqlComponent sqlComponent = new SqlComponent(); sqlComponent.setDataSource(auditDataSource); camelContext.addComponent("sql", sqlComponent); return camelContext; }
Example #13
Source File: EncryptionDynamicTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override public CamelContext createCamelContext() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableKeyException { KeyStore keyStore = KeyStore.getInstance("JCEKS"); ClassLoader classLoader = getClass().getClassLoader(); log.info("Loading keystore from [{}]", classLoader.getResource("shared.jceks").toString()); keyStore.load(classLoader.getResourceAsStream("shared.jceks"), "sharedKeystorePassword".toCharArray()); SimpleRegistry registry = new SimpleRegistry(); registry.put("shared_a", keyStore.getKey("shared_a", "sharedKeyPasswordA".toCharArray())); registry.put("shared_b", keyStore.getKey("shared_b", "sharedKeyPasswordB".toCharArray())); return new DefaultCamelContext(registry); }
Example #14
Source File: CamelVerticle.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override public void start(Future<Void> startFuture) throws Exception { // create camel context SimpleRegistry registry = new SimpleRegistry(); camelContext = new DefaultCamelContext(registry); camelContext.addRoutes(new CamelRoutes()); camelContext.start(); bridge = CamelBridge.create(vertx, new CamelBridgeOptions(camelContext) .addOutboundMapping(OutboundMapping.fromVertx("greetings-counter").toCamel("seda:greetings")) ).start(); }
Example #15
Source File: IdempotentConsumerInTransactionTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); auditDataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql"); registry.put("auditDataSource", auditDataSource); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(auditDataSource); registry.put("transactionManager", transactionManager); SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy(); propagationRequired.setTransactionManager(transactionManager); propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", propagationRequired); auditLogDao = new AuditLogDao(auditDataSource); TransactionTemplate transactionTemplate = new TransactionTemplate(); transactionTemplate.setTransactionManager(transactionManager); transactionTemplate.setPropagationBehaviorName("PROPAGATION_REQUIRES_NEW"); idempotentRepository = new JdbcMessageIdRepository(auditDataSource, transactionTemplate, "ws"); CamelContext camelContext = new DefaultCamelContext(registry); SqlComponent sqlComponent = new SqlComponent(); sqlComponent.setDataSource(auditDataSource); camelContext.addComponent("sql", sqlComponent); return camelContext; }
Example #16
Source File: RollbackMarkRollbackOnlyLastTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); DataSource dataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql"); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource); registry.put("transactionManager", transactionManager); { SpringTransactionPolicy propagationRequiresNew = new SpringTransactionPolicy(); propagationRequiresNew.setTransactionManager(transactionManager); propagationRequiresNew.setPropagationBehaviorName("PROPAGATION_REQUIRES_NEW"); registry.put("PROPAGATION_REQUIRES_NEW", propagationRequiresNew); } { SpringTransactionPolicy propagationRequiresNew2 = new SpringTransactionPolicy(); propagationRequiresNew2.setTransactionManager(transactionManager); propagationRequiresNew2.setPropagationBehaviorName("PROPAGATION_REQUIRES_NEW"); registry.put("PROPAGATION_REQUIRES_NEW-2", propagationRequiresNew2); } auditLogDao = new AuditLogDao(dataSource); messageDao = new MessageDao(dataSource); CamelContext camelContext = new DefaultCamelContext(registry); SqlComponent sqlComponent = new SqlComponent(); sqlComponent.setDataSource(dataSource); camelContext.addComponent("sql", sqlComponent); return camelContext; }
Example #17
Source File: JmsTransactionEndpointTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL(broker.getTcpConnectorUri()); registry.put("connectionFactory", connectionFactory); CamelContext camelContext = new DefaultCamelContext(registry); ActiveMQComponent activeMQComponent = new ActiveMQComponent(); activeMQComponent.setConnectionFactory(connectionFactory); camelContext.addComponent("jms", activeMQComponent); return camelContext; }
Example #18
Source File: JmsTransactionRequestReplyTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://embedded?broker.persistent=false"); registry.put("connectionFactory", connectionFactory); JmsTransactionManager jmsTransactionManager = new JmsTransactionManager(); jmsTransactionManager.setConnectionFactory(connectionFactory); registry.put("jmsTransactionManager", jmsTransactionManager); SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy(); propagationRequired.setTransactionManager(jmsTransactionManager); propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", propagationRequired); SpringTransactionPolicy propagationNotSupported = new SpringTransactionPolicy(); propagationNotSupported.setTransactionManager(jmsTransactionManager); propagationNotSupported.setPropagationBehaviorName("PROPAGATION_NOT_SUPPORTED"); registry.put("PROPAGATION_NOT_SUPPORTED", propagationNotSupported); CamelContext camelContext = new DefaultCamelContext(registry); ActiveMQComponent activeMQComponent = new ActiveMQComponent(); activeMQComponent.setConnectionFactory(connectionFactory); activeMQComponent.setTransactionManager(jmsTransactionManager); camelContext.addComponent("jms", activeMQComponent); return camelContext; }
Example #19
Source File: TransactionPolicyNestedTest.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
@Override protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry = new SimpleRegistry(); dataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql"); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource); registry.put("transactionManager", transactionManager); { SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy(); propagationRequired.setTransactionManager(transactionManager); propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED"); registry.put("PROPAGATION_REQUIRED", propagationRequired); } { SpringTransactionPolicy propagationNotSupported = new SpringTransactionPolicy(); propagationNotSupported.setTransactionManager(transactionManager); propagationNotSupported.setPropagationBehaviorName("PROPAGATION_NOT_SUPPORTED"); registry.put("PROPAGATION_NOT_SUPPORTED", propagationNotSupported); } auditLogDao = new AuditLogDao(dataSource); messageDao = new MessageDao(dataSource); CamelContext camelContext = new DefaultCamelContext(registry); SqlComponent sqlComponent = new SqlComponent(); sqlComponent.setDataSource(dataSource); camelContext.addComponent("sql", sqlComponent); return camelContext; }
Example #20
Source File: RouteBinMain.java From chuidiang-ejemplos with GNU Lesser General Public License v3.0 | 5 votes |
private static CamelContext startCamel() throws Exception { SimpleRegistry registry = new SimpleRegistry(); registry.put("FromDecoder", new MessageDecoder()); registry.put("FromEncoder", new MessageEncoder()); registry.put("ToDecoder", new MessageDecoder()); registry.put("ToEncoder", new MessageEncoder()); final CamelContext context = new DefaultCamelContext(registry); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { createNettyRoute(); } protected void createNettyRoute() { from( "netty:tcp://localhost:55559?encoder=#FromEncoder&" + "decoder=#FromDecoder&" + "disconnectOnNoReply=false&" + "serverClosedChannelExceptionCaughtLogLevel=WARN&" + "keepAlive=true") .to( "netty:tcp://localhost:55560?encoder=#ToEncoder&" + "decoder=#ToDecoder&" + "disconnectOnNoReply=false&" + "serverClosedChannelExceptionCaughtLogLevel=WARN&" + "keepAlive=true") .setId("myRoute"); } }); context.start(); return context; }
Example #21
Source File: CamelMailetContainerModule.java From james-project with Apache License 2.0 | 5 votes |
@Singleton @Provides public DefaultCamelContext provideCamelContext() { DefaultCamelContext camelContext = new DefaultCamelContext(); camelContext.disableJMX(); camelContext.setRegistry(new SimpleRegistry()); return camelContext; }