It's quite possible I'm being dense here, but when I am setting up a
PooledConnectionFactory in java code for the camel ActiveMQ component, the
component is instead creating connections for a broker at
"tcp://localhost:61616" irrespective of what I have passed in to setBrokerURL.
For instance, the following code
PooledConnectionFactory pooledConnectionFactory = new
PooledConnectionFactory();
pooledConnectionFactory.setMaxConnections(8);
pooledConnectionFactory.setMaximumActive(500);
ActiveMQComponent activeMQComponent =
ActiveMQComponent.activeMQComponent("tcp://localhost:61618");
activeMQComponent.setUsePooledConnection(true);
activeMQComponent.setConnectionFactory(pooledConnectionFactory);
camelContext.addComponent("amq", activeMQComponent);
results in this output in the logs:
1916 [ActiveMQ Task-1] INFO
org.apache.activemq.transport.failover.FailoverTransport - Successfully
connected to tcp://localhost:61616
Note the port mismatch. I confirmed it is indeed working with a broker on
localhost at port 61616 whenever I setup a route that includes a
to("amq:queue:SomeQueue"). The same behavior occurs when I change the
hostname/ip as well - it still connects to localhost:61616.
Then once I comment out related to using pooling and keep only the following
two lines:
ActiveMQComponent activeMQComponent =
ActiveMQComponent.activeMQComponent("tcp://localhost:61618");
camelContext.addComponent("amq", activeMQComponent);
Then this works as expected and the camel routes are working against the
broker I have listening on port 61618.
Am I missing something obvious with using PooledConnectionFactory, is this is a
PEBCAK, or is there really something wrong with setting up pooled connections
in the activemq component this way?