I'm trying to figure out the same thing (although I'm working with AMQ, not IBM). Queues seem pretty straightforward, but the topics seem very sensitive to the caching/transaction settings. Don't know the right answer, but interested to know.
JB On 6/4/14 10:24 AM, "dancsi" <[email protected]> wrote: >There is just one more thing I don't see clearly. I found quite >contradicting >information about the use of pooled/cached connection factories. > >First, at >http://tmielke.blogspot.com/2012/03/camel-jms-with-transactions-lessons.ht >ml >I found that it's recommended to use pooled connection factory with Camel >JMS and transactions. >"When using a camel-jms configuration as above, its really important to >use >a pooled ConnectionFactory such as ActiveMQs PooledConnectionFactory or >Springs CachingConnectionFactory. Not using a pooled ConnectionFactory >means >you will open a new JMS connection and session to the broker for every >transaction / message to be received." > >From this, it seems to be obvious that I must use CachingConnectionFactory >(as the broker I use is IBM/WebSphere MQ, I cannot use the >PooledConnectionFactory). > >On the other hand, another source states that it isn't a good idea to use >CachingConnectionFactory for message listeners/consumers. >"It is generally not a good idea to use a caching connection factory with >a >listener container, especially when using maxConcurrentConsumers > >concurrentConsumers - you can end up with cached consumers in the cache, >which get messages where there is no listener, and such messages can get >"stuck". >So, don't use a CCF in this case, it's really intended for use on the >producer side." >http://stackoverflow.com/questions/18863057/closing-session-when-using-spr >ings-cachingconnectionfactory > >Besides, another forum post recommends using WMQ's internal pooling >instead. >http://camel.465427.n5.nabble.com/New-JMS-connection-being-created-for-eve >ry-message-td5637735.html > >So I'm rather mixed whether I should or shouldn't use >CachingConnectionFactory. Can you give any direction? > >My configuration so far is as follows: ><endpoint id="inboundMQMessages" uri="inboundMQ:queue:${queueName}"/> > ><bean:bean id="inboundMQ" >class="org.apache.camel.component.jms.JmsComponent"> ><bean:property name="connectionFactory" ref="mqConnectionFactory"/> ><bean:property name="transacted" value="true"/> ><bean:property name="transactionManager" ref="jmsTxManager"/> ><bean:property name="cacheLevelName" value="CACHE_CONSUMER"/> ><bean:property name="concurrentConsumers" value="10"/> ><bean:property name="maxConcurrentConsumers" value="20"/> ></bean:bean> > ><bean:bean id="requiredJmsTx" >class="org.apache.camel.spring.spi.SpringTransactionPolicy"> ><bean:property name="transactionManager" ref="jmsTxManager"/> ><bean:property name="propagationBehaviorName" >value="PROPAGATION_REQUIRED"/> ></bean:bean> > ><bean:bean id="jmsTxManager" >class="org.springframework.jms.connection.JmsTransactionManager"> > <bean:property name="connectionFactory" ref="mqConnectionFactory"/> ></bean:bean> > ><bean:bean id="mqConnectionFactory" >class="com.ibm.mq.jms.MQQueueConnectionFactory"> ><bean:property name="transportType"> ><util:constant static-field="${mqTransportType}" /> ></bean:property> ><bean:property name="hostName" value="${mqHostName}" /> ><bean:property name="port" value="${mqPort}" /> ><bean:property name="queueManager" value="${mqQueueManager}" /> ><bean:property name="channel" value="${mqSubscriberChannel}" /> ><bean:property name="useConnectionPooling" value="true" /> ><bean:property name="pollingInterval" value="${mqPollingInterval}" /> ><bean:property name="rescanInterval" value="${mqRescanInterval}" /> ></bean:bean> > > > > > >-- >View this message in context: >http://camel.465427.n5.nabble.com/Best-Efforts-1-PC-pattern-from-MQ-to-DB- >tp5751757p5751879.html >Sent from the Camel - Users mailing list archive at Nabble.com. ________________________________ Please note: This email, including attachments, contains information which may be confidential or legally privileged and is only for the use of the individual or entity to whom it is properly addressed. Any unauthorized review, use, disclosure, copying, or distribution is prohibited. If you have reason to believe that you have received this communication in error, or that it may be misaddressed or not intended for you, please destroy it and notify the sender immediately. Thank you.
