[Design of Messaging on JBoss (Messaging/JBoss)] - Re: JBMESSAGING-410 - Use of JmsXA in non transactional envi
by ovidiu.feodorov@jboss.com
No need, Clebert.
This is what happens:
For both JBossMQ and Messaging, the JCA layer creates a JMSManagedConnection instance that delegates to java:/XAConnectionFactory, active JTA transaction or not.
If the JTA transaction is active, the XAResource instance (SpyXAResource for JBossMQ, MessagingXAResource for Messaging) is enlisted with the transaction, otherwise it is, obviously, not.
The difference in behavior becomes apparent when sending the message. JBossMQ session tries to store the message with its SpyXAConnection's resource manager. The SpyXAResourceManager instance doesn't see any xid (xid is null) so immediately sends the message to the server. (SpyXAResourceManager line 115)
Messaging holds the message in its ResourceManager, associating it with a transaction that will never commit.
So the difference is in the JMS implementation, not in the JCA layer, which is identical in both cases, as Tim thoughtfully noticed.
Now the question is what behavior is correct. Well, the common sense says that there is no active JTA transaction at the time of Session creation, the Session is NOT transacted, so JBossMQ behavior is correct. I would treat the current Messaging behavior as a bug.
If you have spec paragraphs to throw at me, go ahead. I am still poring over specs.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968731#3968731
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968731
18 years
[Design of Messaging on JBoss (Messaging/JBoss)] - Re: JBMESSAGING-410 - Use of JmsXA in non transactional envi
by clebert.suconic@jboss.com
My question is when you using JmsXA and not enlist a transaction.
if you add this following test to XATransactionTest, the test will hang (as the message was never sent):
public void test_JmsXA_NonTransactional() throws Exception
| {
| Transaction suspended = TransactionManagerLocator.getInstance().locate().suspend();
|
|
| ConnectionFactory cf = (ConnectionFactory)ic.lookup("java:/JCAConnectionFactory");
|
|
| Connection conn = cf.createConnection();
|
|
|
| Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
| MessageProducer prod = session.createProducer(queue);
| prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
|
| TextMessage m = session.createTextMessage("message one");
| prod.send(m);
| m = session.createTextMessage("message two");
| prod.send(m);
|
| conn.close();
|
| conn = cf.createConnection();
|
| session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
| MessageConsumer cons = session.createConsumer(queue);
|
| conn.start();
|
| TextMessage rm = (TextMessage)cons.receive();
| assertEquals("message one", rm.getText());
| rm = (TextMessage)cons.receive();
| assertEquals("message two", rm.getText());
|
| conn.close();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968702#3968702
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968702
18 years