Jboss Version: 4.0.2

I have this code in my servlet.

InitialContext ctx = new InitialContext() ;
UserTransaction utxn = 
(javax.transaction.UserTransaction)ctx.lookup("java:comp/UserTransaction");
utxn.begin();

-- Some DB related Code here --

XAQueueConnectionFactory jobsQCF = 
(XAQueueConnectionFactory)ctx.lookup("XAConnectionFactory") ;
XAQueueConnection conn = jobsQCF.createXAQueueConnection();
Queue que = (Queue)ctx.lookup(JOBQ) ;
XAQueueSession session = conn.createXAQueueSession();
MessageProducer producer = session.createProducer(que);
int i = 0 ;
while (i < 5) {
        String sampleMessage = "Message(" + i + ") sent by " + 
this.getClass().getName() + " @"
                        + new java.util.Date() ;
        TextMessage msg = session.createTextMessage(sampleMessage) ;
        producer.send(msg);
        Thread.sleep(2000) ;
        i++ ;
}

utxn.commit();

The  MDB is receiving the messages before my commit.

I have tried with ConnectionFactory/Connection/Session before I changed to XA 
interfaces?



What am I missing?



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3881011#3881011

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3881011


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to