"timfox" wrote : Probably spring isn't enlisting the JBM xa resource properly 
with the global tx.
  | 
  | But I can't really comment on the internal workings of Spring. You're best 
best is to debug the Spring code, or ask a Spring expert.

Ok so, just to be sure, I have discarded the @Transactional annotations from 
the bean and modified the example above to manually get the UserTransaction, 
begin and commit that transaction around the sending of the messages and I get 
exactly the same behaviour - only one message is actually delivered, the first 
one that I "send". At this point, Spring isn't involved in the sending side of 
the transaction at all (well, ok, apart from wrapping a JDK proxy around my 
bean...see my note on deployment below).


  | InitialContext ic = new InitialContext();
  | tx = (UserTransaction) ic.lookup("java:comp/UserTransaction");
  | tx.begin();
  | 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();
  | Thread.sleep(7000);
  | tx.commit();
  | 

To clarify how I'm invoking the above code: I am still deploying the bean in a 
spring app context but I am exporting it as an MBean and then invoking an 
operation using jboss's jmx console. In this most recent effort, I turned on 
debug logging for spring's tx framework and have confirmed that it was not 
attempting to do anything transactional around my test (at debug level it is 
pretty verbose about what it's up to..)


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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191722
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to