We use following configuration for AMQ
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${brokerURL1}"/>
</bean>
<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
<property name="maxConnections" value="10"/>
<property name="maximumActive" value="100"/>
<property name="connectionFactory" ref="jmsConnectionFactory"/>
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="transacted" value="false"/>
<property name="concurrentConsumers" value="5"/>
<property name="maxConcurrentConsumers" value="10"/>
</bean>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
Periodically I have strange issue - loose message. Actually AMQ says everything OK and message is dequeued but there is no message on app...
I've read it can be issue with caching consumers and instead JmsConfiguration should be used following config
<bean id="jmsConfig" class="org.apache.activemq.camel.component.ActiveMQConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="transacted" value="false"/>
<property name="concurrentConsumers" value="5"/>
<property name="maxConcurrentConsumers" value="10"/>
<property name="cacheLevelName" value="CACHE_CONSUMER"/>
</bean>
Does anybody know how to properly to configure activemq? which values should be set for best performance and good reliability?
<property name="maxConnections" value="?"/>
<property name="maximumActive" value="?"/>
<property name="concurrentConsumers" value="?"/>
<property name="maxConcurrentConsumers" value="?"/>
Should I use org.apache.activemq.pool.PooledConnectionFactory
or there is better approach?
It seems like you are more asking how to configure Apache Camel how to use ActiveMQ.
There are many ways to configure pooling etc. heavily depending on which usage/load patterns you see in your setup and what your requirements are. Those settings you are refering to maxConcurrentConsumers etc. will depend on your Camel routes and how many consumers you setup there for instance.
Simply, there are two scenarios to optimize for: Sending and receiving messages (request/reply comes to mind as well, but that's a different story).
If you receive a lot of messages in your app, then you typically setup message listeners and pooling is not much help, since you do not create/tear down a lot of connections/sessions. Just make sure you configure enough concurrent consumers - how many depends on your hardware (# CPU cores etc) and the size of each message. You have to measure your specific setup for best performance.
When you send messages, Camel suggests the PooledConnectionFactory of ActiveMQ as you say. The documentation linked to also suggests some default values for the settings you are asking for.
<property name="maxConnections" value="8" />
<property name="maximumActive" value="500" />
<property name="transacted" value="false"/>
For max reliability, you should use transacted sessions and commit the received message once you have it safely processed.
Strange that you say you lose messages, there is not anything specific in your settings that would make you lose messages. You need to track this down a bit futher or give some info on the app implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With