As per Apache camel's documentation, we should set Cache level to CACHE_CONSUMER to gain better performance while dealing with non-XA transactions. Probably they did so, as PooledConnectionFactory doesn't cache consumers.
In place of PooledConnectionFactory, I am using Spring's CachingConnectionFactory because PooledConnectionFactory is some what coupled with ActiveMQ and I am dealing with IBMMQ.
CachingConnectionFactory on the other hand, caches producers and consumers as well. So I hope in this case, there is no point in setting the cache level of JmsComponent to CACHE_CONSUMER.
Please correct me if I am wrong. Any advice would be of great help
Yes, I feel your understanding is right here.
As stated in one of the comment of this blog,
Although both the
PooledConnectionFactory
and theCachingConnectionFactory
state that they each pool connections, sessions and producers, thePooledConnectionFactory
does not actually create a cache of multiple producers. It simply uses a singleton pattern to hand out a single cached producer when one is requested. Whereas theCachingConnectionFactory
actually creates a cache containing multiple producers and hands out one producer from the cache when one is requested.
By caching at the consumer level i.e. setting CACHE_CONSUMER
, it implies that the connection, the session and the consumer is cached.
However, by using CachingConnectionFactory
, as documented, you get both consumer and producer caching defaulted to true
and also gain control over them, if needed. Hence no more cache level is required.
Additional help : Camel Docs