[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: JBMESSAGING-410 - Use of JmsXA in non transactional envi

clebert.suconic@jboss.com do-not-reply at jboss.com
Thu Aug 31 12:51:09 EDT 2006


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



More information about the jboss-dev-forums mailing list