activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edan <>
Subject Re: ActiveMQ's JNDI does not resolve XAConnectionFactory
Date Thu, 18 Mar 2010 18:39:50 GMT

Gary Tully wrote:
> you need to change
> the
> org.apache.activemq.jndi.ActiveMQInitialContextFactory.createConnectionFactory(Hashtable)
> method to optionally create an ActiveMQXAConnectionFactory
> I think it would be a sensible default but having a property that can
> ensure
> that a particular factory is xa would be a nice addition.
> have a look
> at
> org.apache.activemq.jndi.ActiveMQInitialContextFactory.createConnectionFactory(String,
> Hashtable) to see the naming convention for how additional properties are
> specified.

Thanks for the quick response, Gary!   I think a stumbling block for me was
that I assumed the openwire connector had some magic JNDI code inside--I
didn't realize the JNDI connectionfactory lookup was really all on the
client side :)

I didn't quite understand how to modify
ActiveMQInitialContextFactory.createConnectionFactory() to optionally create
an ActiveMQXAConnectionFactory, though, since it returns an
ActiveMQConnectionFactory.  Are you suggesting it could always return
ActiveMQXAConnectionFactory and let people cast it to a plain
ConnectionFactory when they don't want XA?

My quick patch which seems to be working was to modify the
getInitialContext(environment) method to create a
ActiveMQXAConnectionFactory when the "name" from the environment equals
"XAConnectionFactory" and I copied the two createConnectionFactory() methods
and made createXAConnectionFactory methods, so it looks like:  

I suppose it would be less duplicated code to always return an
ActiveMQXAConnectionFactory, but I wasn't sure about that part. I'll think
about it some more, let me know what you think of my current hack ;)

Thanks again.
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message