If you are using ActiveMQ, note that the JMS component reuses Spring 2's
JmsTemplate for sending messages. This is not ideal for use in a non-J2EE
container and typically requires some caching in the JMS provider to avoid poor performance
If you intend to use Apache ActiveMQ as your Message Broker, then we recommend that you either:
Use the Camel Component: ActiveMQ component, which is already configured to use ActiveMQ efficiently, or
If you are consuming messages and using transactions (transacted=true) then the default
settings for cache level can impact performance. If you are using XA transactions then you
cannot cache as it can cause the XA transaction not to work properly. If you are not using
XA, then you should consider caching as it speeds up performance, such as setting
The default setting for cacheLevelName is
CACHE_AUTO. This default auto
detects the mode and sets the cache level accordingly to:
CACHE_CONSUMER= if transacted = false
CACHE_NONE= if transacted = true
So you can say the default setting is conservative. Consider using
CACHE_CONSUMER if you are using non-XA transactions.
If you wish to use durable topic subscriptions, you need to specify both clientId and durableSubscriptionName. The value of the
clientId must be unique
and can only be used by a single JMS connection instance in your entire network. You may
prefer to use Virtual Topics instead to avoid this limitation. More background on durable
messaging is available on the ActiveMQ site.
When using message headers, the JMS specification states that header names must be valid Java identifiers. So try to name your headers to be valid Java identifiers. One benefit of doing this is that you can then use your headers inside a JMS Selector (whose SQL92 syntax mandates Java identifier syntax for headers).
A simple strategy for mapping header names is used by default. The strategy is to replace any dots in the header name with the underscore character and to reverse the replacement when the header name is restored from a JMS message sent over the wire. What does this mean? No more losing method names to invoke on a bean component, no more losing the filename header for the File Component, and so on.
The current header name strategy for accepting header names in Camel is as follows:
Dots are replaced by
_DOT_and the replacement is reversed when Camel consumes the message. (for example,
Hyphen is replaced by
_HYPHEN_and the replacement is reversed when Camel consumes the message.
Are you using transactions? If you are consuming messages, and have transacted=true, then the default settings for cache level can impact performance. The default setting is always CACHE_CONSUMER. However, with the CACHE_AUTO setting, when you use transactions the cache level is effectively set to CACHE_NONE, appropriate for transactions.