I have noticed in several examples, the common way to configure activemq with
camel is with the following beans. I would like to know if Spring Boot
already configures any of these beans by default. I know that if the
activemq jars are on the class path a default connection factory is created,
but what about everything below?
<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
init-method="start" destroy-method="stop">
<property name="maxConnections" value="8"/>
<property name="connectionFactory" ref="jmsConnectionFactory"/>
</bean>
<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="concurrentConsumers" value="10"/>
</bean>
<bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
<property name="transacted" value="true"/>
<property name="cacheLevelName" value="CACHE_CONSUMER"/>
</bean>
or
@Bean
public ActiveMQConnectionFactory getConnectionFactory() {
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory();
connectionFactory.setBrokerURL(brokerURL);
return connectionFactory;
}
@Bean(initMethod = "start", destroyMethod = "stop")
public PooledConnectionFactory getPooledConnectionFactory() {
PooledConnectionFactory pooledConnectionFactory = new
PooledConnectionFactory();
pooledConnectionFactory.setMaxConnections(maxConnections);
pooledConnectionFactory.setConnectionFactory(getConnectionFactory());
return pooledConnectionFactory;
}
@Bean
public JmsConfiguration getJmsConfiguration() {
JmsConfiguration jmsConfiguration = new JmsConfiguration();
jmsConfiguration.setConnectionFactory(getPooledConnectionFactory());
return jmsConfiguration;
}
@Bean
public JmsConfiguration getJmsHighPriorityConfiguration() {
JmsConfiguration jmsConfiguration = new JmsConfiguration();
jmsConfiguration.setConnectionFactory(getPooledConnectionFactory());
jmsConfiguration.setPriority(8);
return jmsConfiguration;
}
@Override
protected void setupCamelContext(CamelContext camelContext) throws
Exception {
ActiveMQComponent activeMQComponent = new ActiveMQComponent();
activeMQComponent.setConfiguration(getJmsConfiguration());
camelContext.addComponent("activemq", activeMQComponent);
ActiveMQComponent activeMQHighPriorityComponent = new
ActiveMQComponent();
activeMQHighPriorityComponent.setConfiguration(getJmsHighPriorityConfiguration());
camelContext.addComponent("activemq-high-priority",
activeMQHighPriorityComponent);
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-and-Activemq-setup-with-Spring-Boot-tp5774544.html
Sent from the Camel - Users mailing list archive at Nabble.com.