You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jsimmonsc <js...@gmail.com> on 2012/11/06 22:50:11 UTC

XaPooledConnectionFactory

Hello,

We are trying to setup ActiveMQ XA transactions with websphere mq and a
postgres database.  We were using ActiveMQ 5.6.0 and camel 2.9.2 inside of a
karaf container with version 2.2.9.

The setup that we used was documented on fusesource website.

Fusesource Documentation
<http://fusesource.com/docs/esbent/7.0/camel_tx/XaJms-Sample.html>  

Everything most works except for the memory leak as outlined in  AMQ-3997
<https://issues.apache.org/jira/browse/AMQ-3997>  .

When we saw the release of active mq 5.7.0, we tried to update all of our
code to use the camel 2.10 series and active mq 5.7.0.  We are now having
problems getting the transaction to enlist in XA transactions.  Looking at
the source code, I cannot find anywhere that calls the createConnecitonPool
in org.apache.activemq.pool.XaPooledConnectionFactory.  It appears that the
PooledConnectionFactory used to delegate to this method, but it does not any
more.

I'm curious as to how this is supposed to work now.  I have tried to look
for any documentation about giving a JmsComponent a connection pool, but
cannot do so.  

Any help on the matter is greatly appreciated.

Josh



--
View this message in context: http://activemq.2283324.n4.nabble.com/XaPooledConnectionFactory-tp4658865.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: XaPooledConnectionFactory

Posted by Gary Tully <ga...@gmail.com>.
great.
send a pull request to fusesource, so we can take your changes on
board as soon as you are happy with them.

On 7 November 2012 12:35, jsimmonsc <js...@gmail.com> wrote:
> Thanks for the quick response and for confirming what I was seeing.  I don't
> know if it will be of help but I've temporarily forked the fusesource jms
> pool and applied the fixes made for the memory leak.
>
> https://github.com/jsimmonsc/jmspool
>
> If there is anything else I can do to help, please let me know.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/XaPooledConnectionFactory-tp4658865p4658916.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com

Re: XaPooledConnectionFactory

Posted by jsimmonsc <js...@gmail.com>.
Thanks for the quick response and for confirming what I was seeing.  I don't
know if it will be of help but I've temporarily forked the fusesource jms
pool and applied the fixes made for the memory leak.

https://github.com/jsimmonsc/jmspool

If there is anything else I can do to help, please let me know.



--
View this message in context: http://activemq.2283324.n4.nabble.com/XaPooledConnectionFactory-tp4658865p4658916.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: XaPooledConnectionFactory

Posted by Gary Tully <ga...@gmail.com>.
k, at least you have a workaround.
I had a peek at the code and I see what you saw.. this is a regression from
https://issues.apache.org/jira/browse/AMQ-4019

the xa factory has been left behind a bit with that refactor.

On 7 November 2012 12:21, jsimmonsc <js...@gmail.com> wrote:
> My entire context is below.
>
> If I switch out the org.apache.activemq.pool.XaPooledConnectionFactory with
> a org.fusesource.jms.pool.XaPooledConnectionFactory, everything works as
> expected except for the previously mentioned memory leak fixed in AMQ-3997.
>
>
> Just in case it's needed, my route:
>
> from("activemq:josh.test.queue")
>                         .transacted()
>                         .to("activemq:josh.test.queue2")
>                         .process(new Processor() {
>                                 public void process(Exchange arg0) throws Exception {
>                                         Thread.sleep(5000);
>                                 }
>                         })
>                         .rollback();
> My context:
>
>
>         <camel:camelContext xmlns="http://camel.apache.org/schema/spring">
>                 <package>josh.test</package>
>         </camel:camelContext>
>
>         <ctx:property-placeholder
> location="file:${user.home}/ApplicationData/amq.properties" />
>
>         <osgi:reference id="osgiPlatformTransactionManager"
> interface="org.springframework.transaction.PlatformTransactionManager"/>
>         <osgi:reference id="osgiJtaTransactionManager"
> interface="javax.transaction.TransactionManager"/>
>
>         <bean id="PROPAGATION_REQUIRED"
> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>           <property name="transactionManager"
> ref="osgiPlatformTransactionManager"/>
>           <property name="propagationBehaviorName"
> value="PROPAGATION_REQUIRED"/>
>         </bean>
>
>         <bean id="activeMQConnectionFactory"
> class="org.apache.activemq.ActiveMQXAConnectionFactory">
>             <property name="brokerURL" value="${amqBrokerURL}"/>
>             <property name="userName" value="${amqUsername}"/>
>              <property name="password" value="${amqPassword}"/>
>         </bean>
>
>         <bean id="activeMQPooledConnection"
> class="org.apache.activemq.pool.XaPooledConnectionFactory"
> init-method="start" destroy-method="stop">
>         <property name="maxConnections" value="1" />
>         <property name="connectionFactory" ref="activeMQConnectionFactory"
> />
>         <property name="transactionManager" ref="osgiJtaTransactionManager"
> />
>     </bean>
>
>     <bean id="activeMQConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>         <property name="connectionFactory" ref="activeMQPooledConnection"/>
>         <property name="transactionManager"
> ref="osgiPlatformTransactionManager"/>
>         <property name="transacted" value="false"/>
>     </bean>
>
>         <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>             <property name="configuration" ref="activeMQConfig" />
>         </bean>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/XaPooledConnectionFactory-tp4658865p4658913.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com

Re: XaPooledConnectionFactory

Posted by jsimmonsc <js...@gmail.com>.
My entire context is below.  

If I switch out the org.apache.activemq.pool.XaPooledConnectionFactory with
a org.fusesource.jms.pool.XaPooledConnectionFactory, everything works as
expected except for the previously mentioned memory leak fixed in AMQ-3997.


Just in case it's needed, my route:

from("activemq:josh.test.queue")
			.transacted()
			.to("activemq:josh.test.queue2")
			.process(new Processor() {
				public void process(Exchange arg0) throws Exception {
					Thread.sleep(5000);
				}
			})
			.rollback();
My context:


  	<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
		<package>josh.test</package>
	</camel:camelContext>

	<ctx:property-placeholder
location="file:${user.home}/ApplicationData/amq.properties" />

	<osgi:reference id="osgiPlatformTransactionManager"
interface="org.springframework.transaction.PlatformTransactionManager"/>
	<osgi:reference id="osgiJtaTransactionManager"
interface="javax.transaction.TransactionManager"/>
	
	<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
    	  <property name="transactionManager"
ref="osgiPlatformTransactionManager"/>
    	  <property name="propagationBehaviorName"
value="PROPAGATION_REQUIRED"/>
	</bean>

	<bean id="activeMQConnectionFactory"
class="org.apache.activemq.ActiveMQXAConnectionFactory">
    	    <property name="brokerURL" value="${amqBrokerURL}"/>
            <property name="userName" value="${amqUsername}"/>
             <property name="password" value="${amqPassword}"/>
	</bean>
	
	<bean id="activeMQPooledConnection"
class="org.apache.activemq.pool.XaPooledConnectionFactory"
init-method="start" destroy-method="stop"> 
        <property name="maxConnections" value="1" /> 
        <property name="connectionFactory" ref="activeMQConnectionFactory"
/>
        <property name="transactionManager" ref="osgiJtaTransactionManager"
/>
    </bean> 
    
    <bean id="activeMQConfig"
class="org.apache.camel.component.jms.JmsConfiguration"> 
        <property name="connectionFactory" ref="activeMQPooledConnection"/> 
        <property name="transactionManager"
ref="osgiPlatformTransactionManager"/> 
        <property name="transacted" value="false"/>
    </bean>      	
    
	<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
	    <property name="configuration" ref="activeMQConfig" />
	</bean>




--
View this message in context: http://activemq.2283324.n4.nabble.com/XaPooledConnectionFactory-tp4658865p4658913.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: XaPooledConnectionFactory

Posted by Gary Tully <ga...@gmail.com>.
can you post your xml configuration for the came context.

the enlistment is done automatically by XaPooledConnectionFactory once
it gets a handle
on the transactionmanager that has an active transaction

<!-- connection factory wrapper to support auto-enlisting of XA resource -->
    <bean id="jmsXaPoolConnectionFactory"
          class="org.apache.activemq.pool.XaPooledConnectionFactory">
        <property name="maxConnections" value="1" />
        <property name="connectionFactory" ref="jmsXaConnectionFactory" />
        <property name="transactionManager" ref="osgiJtaTransactionManager" />
    </bean>

On 6 November 2012 21:50, jsimmonsc <js...@gmail.com> wrote:
> Hello,
>
> We are trying to setup ActiveMQ XA transactions with websphere mq and a
> postgres database.  We were using ActiveMQ 5.6.0 and camel 2.9.2 inside of a
> karaf container with version 2.2.9.
>
> The setup that we used was documented on fusesource website.
>
> Fusesource Documentation
> <http://fusesource.com/docs/esbent/7.0/camel_tx/XaJms-Sample.html>
>
> Everything most works except for the memory leak as outlined in  AMQ-3997
> <https://issues.apache.org/jira/browse/AMQ-3997>  .
>
> When we saw the release of active mq 5.7.0, we tried to update all of our
> code to use the camel 2.10 series and active mq 5.7.0.  We are now having
> problems getting the transaction to enlist in XA transactions.  Looking at
> the source code, I cannot find anywhere that calls the createConnecitonPool
> in org.apache.activemq.pool.XaPooledConnectionFactory.  It appears that the
> PooledConnectionFactory used to delegate to this method, but it does not any
> more.
>
> I'm curious as to how this is supposed to work now.  I have tried to look
> for any documentation about giving a JmsComponent a connection pool, but
> cannot do so.
>
> Any help on the matter is greatly appreciated.
>
> Josh
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/XaPooledConnectionFactory-tp4658865.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com