[jboss-user] [JBoss Messaging] - Can only send one message in XA transaction
orankelly
do-not-reply at jboss.com
Fri Nov 21 11:15:42 EST 2008
I'm having a problem with Jboss 4.2.3.GA + Jboss messaging 1.4.0SP3. I am sending multiple messages within a JTA transaction. However, at transaction commit time, only the first message sent is actually delivered to the destination (a topic).
My app is Spring-based and I normally use the JmsTemplate support but to try to eliminate the possibility that Spring was the problem, I threw together a simple bean that did the following in a method annotated with Spring's @Transactional notation with propagation REQUIRED:
| InitialContext ic = new InitialContext();
| Context context = (Context) ic.lookup("java:comp/env");
| Destination dest = (Destination) context.lookup("jms/MyTopic");
| // jms/ConnectionFactory is tied to java:/JmsXA
| ConnectionFactory cf = (ConnectionFactory) context.lookup("jms/ConnectionFactory");
| Connection conn = cf.createConnection();
| Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
| MessageProducer producer = s.createProducer(dest);
| TextMessage m = s.createTextMessage("Message 1");
| producer.send(m);
| m = s.createTextMessage("Message 2");
| producer.send(m);
| m = s.createTextMessage("Message 3");
| producer.send(m);
| s.close();
| conn.close();
|
Upon invoking this, only one message gets delivered to the topic after the method returns (and therefore the transaction commits). This confuses me no end. If there was a problem in the method that caused a rollback, no messages would be delivered, right? Likewise if there was a problem during the actual commit.
If I change over to using the non-XA "ConnectionFactory" and invoke the same code, all three of the messages get delivered.
Anyone any hints as to why this would be?
(I have configured jboss-messaging as per the instructions in its documentation. I am also using mysql as the persistence provider rather than the default hsqldb. My default engine is InnoDB so the JBM_ tables are all using that engine and my tx isolation level is READ_COMMITTED.)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4191328#4191328
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191328
More information about the jboss-user
mailing list