0

I'm using servicemix and camel to publish to some activemq topics:

from("vm:all").recipientList().simple(String.format("activemq:topic:%s.%s.%s.%s.%s.%s","${header.type}", ...

but a new producer thread gets created per topic, any idea how I can control that?

Edit1:

Actually I realized that I was creating too many topics and should you Selectors instead: http://www.andrejkoelewijn.com/blog/2011/02/21/camel-activemq-topic-route-with-jms-selector/

Thanks for the help!

рüффп
  • 5,172
  • 34
  • 67
  • 113

1 Answers1

1

The typical scenario is that Camel is using JMSTemplate to fire messages to ActiveMQ. That means it creates a new producer each time. Actually, it creates a new connection, session and producer per message. That is usually no issue except performance wise.

This is typically handled by org.apache.activemq.pool.PooledConnectionFactory which caches connections, sessions and producers for you. However, depending on your configuration, it might create "some" producers initially, but they will be reused.

Check your Connection Factory settings in activemq-broker.xml and make sure you grab the PooledConnectionFactory.

Petter Nordlander
  • 22,053
  • 5
  • 50
  • 84