Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 00483903C for ; Wed, 29 Feb 2012 14:56:22 +0000 (UTC) Received: (qmail 42039 invoked by uid 500); 29 Feb 2012 14:56:21 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 42015 invoked by uid 500); 29 Feb 2012 14:56:21 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 42008 invoked by uid 99); 29 Feb 2012 14:56:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Feb 2012 14:56:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Feb 2012 14:56:18 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id C96A9C74FF for ; Wed, 29 Feb 2012 14:55:56 +0000 (UTC) Date: Wed, 29 Feb 2012 14:55:56 +0000 (UTC) From: "Torsten Mielke (Created) (JIRA)" To: issues@camel.apache.org Message-ID: <1000675705.3169.1330527356826.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (CAMEL-5055) Offer a way to not set a transaction manager in activemq-camel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Offer a way to not set a transaction manager in activemq-camel --------------------------------------------------------------- Key: CAMEL-5055 URL: https://issues.apache.org/jira/browse/CAMEL-5055 Project: Camel Issue Type: Improvement Components: camel-activemq, camel-jms Affects Versions: 2.9.0 Reporter: Torsten Mielke The following sample Spring config sets up a camel-activemq component {code:xml} {code} The ActiveMQConfiguration sets transacted=true and configures for a JmsTransactionManager. Also, a PooledConnectionFactory is used. The config for a camel-jms component would be similar. The Spring JMS javadoc on [AbstractPollingMessageListenerContainer.setTransactionManager|http://static.springsource.org/spring/docs/3.0.5.RELEASE/api/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.html#setTransactionManager(org.springframework.transaction.PlatformTransactionManager)] states: {quote} Note: Consider the use of local JMS transactions instead. Simply switch the "sessionTransacted" flag to "true" in order to use a locally transacted JMS Session for the entire receive processing, including any Session operations performed by a SessionAwareMessageListener (e.g. sending a response message). {quote} It basically advises to only set transacted=true and don't specify a TX manager. The benefit of doing so is that the cacheLevel setting will be honored when using local transactions without a configured TX manager. When a TX manager is configured, no caching happens at DMLC level and its necessary to rely on a pooled connection factory. This is discussed [here|http://forum.springsource.org/showthread.php?123631-JMS-DMLC-not-caching-connection-when-using-TX-despite-cacheLevel-CACHE_CONSUMER&p=403530&posted=1#post403530]. However right now its not possible to configure the cameljms or camel-activemq component to not use an external TX manager when transacted=true is set. Even when setting lazyCreateTransactionManager=false. In case of camel-activemq, it still creates a default JmsTransactionManager: {code:title=ActiveMQConfiguration.java} public PlatformTransactionManager getTransactionManager() { PlatformTransactionManager answer = super.getTransactionManager(); if (isTransacted() && answer == null) { // lets auto-default the transaction manager if its not specified answer = createTransactionManager(); setTransactionManager(answer); answer = getTransactionManager(); } return answer; } {code} In case of camel-jms it throws an exception: {code:title=JmsConfiguration.java} PlatformTransactionManager tm = getTransactionManager(); if (tm != null) { container.setTransactionManager(tm); } else if (transacted) { throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!"); } {code} We should allow for using transactions in camel-jms and camel-activemq without setting an external TX manager. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira