Mobility
Mobility

Reputation: 3305

How can ActiveMQ component use connection pool without spring config?

http://camel.apache.org/activemq.html.

This article only gives a way to use connection pool with spring configs.

I wonder if this way can use connection pool?

context.addComponent("activemq", ActiveMQComponent.activeMQComponent("tcp://10

as by this way, all contents are written in java code, I can easily add or remove a component during runtime without modifying spring config.

Upvotes: 0

Views: 558

Answers (1)

Hassen Bennour
Hassen Bennour

Reputation: 3913

simply like this :

ActiveMQComponent answer = ActiveMQComponent.activeMQComponent();
ActiveMQConnectionFactory jmsConnectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory(jmsConnectionFactory);
((ActiveMQConfiguration) answer.getConfiguration()).setConnectionFactory(pooledConnectionFactory);
context.addComponent("activemq", answer);

Upvotes: 1

Related Questions