1. My ActiveMQXAConnection.createXASession() implementation looks like
dirty hack and can't work propertly because transaction started but not
commited anywhere. What is the rigth place to start and commit/rollback
transaction?
Normally the JCA container does this. If you are using Spring then the
Spring Transaction Manager or Message Listener container shoudl do
this - not the connection factory
2. Is it possible to include similar ActiveMQXAConnectionFactory
implementation into ActiveMQ? It will be very useful for using with
Spring DefaultMessageListenerContainer for example.
I'd rather fix Spring's container to work with any JMS provider
properly than adding a dirty hack to ActiveMQ
Enlistment is the responsibility of the container - be it Jencks, MDB
container or Spring.
But org.jencks.pool.PooledSpringXAConnectionFactory enlists XA session
with JTA transaction. It's only do this in single thread but can't do
with XA connection and XA session in separate threads - see topic "Using
PooledSpringXAConnectionFactory in different threads" above in mail list.
Is this design wrong or it can by used in some cases? What's the
difference between PooledSpringXAConnectionFactory and my approach?
Now JTA transactions
can't work with ActiveMQ/Spring/DefaultMessageListenerContainer.
You'd best ask the Spring guys - I'm not sure if the Spring container
supports JTA
Spring supports nothing ... but it can wrap many technoogies such as JTA
by wrapping JOTM, Geronimo or some other transaction managers.