You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Torsten Mielke (Created) (JIRA)" <ji...@apache.org> on 2012/02/29 15:55:56 UTC

[jira] [Created] (CAMEL-5055) Offer a way to not set a transaction manager in activemq-camel

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}
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
     <property name="configuration" ref="jmsConfigAmq" />
  </bean>
  
  <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
      <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
      <property name="transacted" value="true"/> 
      <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
      <property name="cacheLevelName" value="CACHE_CONSUMER"/>
  </bean>
  
  <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
  </bean>           
     
  <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
    <property name="brokerURL" value="tcp://localhost:61617" /> 
    <property name="watchTopicAdvisories" value="false" />
  </bean>
	    
   <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
      <property name="maxConnections" value="1"/>
      <property name="connectionFactory" ref="jmsConnectionFactory"/>
   </bean>
{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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287379#comment-13287379 ] 

Babak Vahdat commented on CAMEL-5055:
-------------------------------------

No I don't think so, as what this JIRA ticket resolved was *only* to change the behaviour in the case where transacted was true but there was no transactionManager to be injected.

That's the change is instead of throwing IllegalArgumentException like:

{code}
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 do now:

{code}
PlatformTransactionManager tm = getTransactionManager();
if (tm != null) {
  container.setTransactionManager(tm);
} else if (transactionManager == null && transacted && !lazyCreateTransactionManager) {
  container.setSessionTransacted(true);
}
{code}

And that's it!

Maybe verify/check other potential changes you may have done in your config, code and whatnot. And please use the User-Forum for any further Questions you may have where you could still reference this ticket.
                
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>         Attachments: camel-5055acknowledgeMode_SESSION_TRANSACTED_cannot_be_used_for_an_non-transacted_Session.zip
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13284956#comment-13284956 ] 

Babak Vahdat commented on CAMEL-5055:
-------------------------------------

Thanks for the hint. I did a mistake where I unintentionally removed one existing line:

{code}
container.setSessionTransacted(transacted); 
{code} 

I did revert this which now makes your test pass again.
                
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>         Attachments: camel-5055acknowledgeMode_SESSION_TRANSACTED_cannot_be_used_for_an_non-transacted_Session.zip
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in activemq-camel

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272378#comment-13272378 ] 

Babak Vahdat commented on CAMEL-5055:
-------------------------------------

Torsten, do you already work on a patch or am I allowed to take over this? 
                
> 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
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Marco Zapletal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13284858#comment-13284858 ] 

Marco Zapletal commented on CAMEL-5055:
---------------------------------------

With this change, a config like the one mentioned in the description does not work any longer by failing with 'javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session."

Please find attached a test case showing the exception (or did I miss anything in the config?)

                
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Updated] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Marco Zapletal (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marco Zapletal updated CAMEL-5055:
----------------------------------

    Attachment: camel-5055acknowledgeMode_SESSION_TRANSACTED_cannot_be_used_for_an_non-transacted_Session.zip
    
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>         Attachments: camel-5055acknowledgeMode_SESSION_TRANSACTED_cannot_be_used_for_an_non-transacted_Session.zip
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Updated] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Babak Vahdat updated CAMEL-5055:
--------------------------------

    Summary: Offer a way to not set a transaction manager in camel-jms  (was: Offer a way to not set a transaction manager in activemq-camel )
    
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Comment Edited] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283995#comment-13283995 ] 

Babak Vahdat edited comment on CAMEL-5055 at 5/26/12 3:25 PM:
--------------------------------------------------------------

I opened AMQ-3861 to track this on AMQ side as well.
                
      was (Author: bvahdat):
    I opend AMQ-3861 to track this on AMQ side as well.
                  
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Marco Zapletal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287351#comment-13287351 ] 

Marco Zapletal commented on CAMEL-5055:
---------------------------------------

Thanks. Since some days, I also notice that approx. 5% of my messages get redelivered

Example log entry: Transaction commit (0x26b5f36e) redelivered(true) for (MessageId: ID:MYSERVER-51520-1338396250920-0:4:2:1:30 on ExchangeId: ID-4711)) [Camel (myserver) thread #8 - JmsConsumer[MyJMSQueue]] [o.a.c.s.s.TransactionErrorHandler]  

Could it be the case that the patch provokes this, since I haven't had these redeliveries before.
                
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>         Attachments: camel-5055acknowledgeMode_SESSION_TRANSACTED_cannot_be_used_for_an_non-transacted_Session.zip
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283994#comment-13283994 ] 

Babak Vahdat commented on CAMEL-5055:
-------------------------------------

Now you can reach the behaviour using:

{code}
transacted=true
lazyCreateTransactionManager=false
{code}
                
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Resolved] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Babak Vahdat resolved CAMEL-5055.
---------------------------------

    Resolution: Fixed
    
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in camel-jms

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283995#comment-13283995 ] 

Babak Vahdat commented on CAMEL-5055:
-------------------------------------

I opend AMQ-3861 to track this on AMQ side as well.
                
> Offer a way to not set a transaction manager in camel-jms
> ---------------------------------------------------------
>
>                 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Assigned] (CAMEL-5055) Offer a way to not set a transaction manager in activemq-camel

Posted by "Babak Vahdat (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Babak Vahdat reassigned CAMEL-5055:
-----------------------------------

    Assignee: Babak Vahdat
    
> 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
>            Assignee: Babak Vahdat
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in activemq-camel

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220023#comment-13220023 ] 

Claus Ibsen commented on CAMEL-5055:
------------------------------------

Torsten, you are welcome to work on a patch.
                
> 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
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Commented] (CAMEL-5055) Offer a way to not set a transaction manager in activemq-camel

Posted by "Torsten Mielke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13279993#comment-13279993 ] 

Torsten Mielke commented on CAMEL-5055:
---------------------------------------

I am not working on this bug right now (due to missing time). So feel free to implement a solution. 
Many thx.
Torsten

                
> 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
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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

        

[jira] [Updated] (CAMEL-5055) Offer a way to not set a transaction manager in activemq-camel

Posted by "Claus Ibsen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-5055:
-------------------------------

    Fix Version/s: 2.10.0
    
> 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
>              Labels: camel-jms, transactions
>             Fix For: 2.10.0
>
>
> The following sample Spring config sets up a camel-activemq component
> {code:xml}
> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
>      <property name="configuration" ref="jmsConfigAmq" />
>   </bean>
>   
>   <bean id="jmsConfigAmq" class="org.apache.activemq.camel.component.ActiveMQConfiguration" >
>       <property name="connectionFactory" ref="jmsPooledConnectionFactory" /> 
>       <property name="transacted" value="true"/> 
>       <!--  <property name="transactionManager" ref="jmsTransactionManager" />  -->
>       <property name="cacheLevelName" value="CACHE_CONSUMER"/>
>   </bean>
>   
>   <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
>     <property name="connectionFactory" ref="jmsPooledConnectionFactory" />
>   </bean>           
>      
>   <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
>     <property name="brokerURL" value="tcp://localhost:61617" /> 
>     <property name="watchTopicAdvisories" value="false" />
>   </bean>
> 	    
>    <bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" >
>       <property name="maxConnections" value="1"/>
>       <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    </bean>
> {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