[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Transaction management in JCA adapter is screwed up

timfox do-not-reply at jboss.com
Fri Jul 17 05:26:52 EDT 2009


I just took a look at the tx management code in the JCA adapter, and it looks just plain wrong in places.

JBMMessageHandler::onMessage.

Firstly it seems a transaction is *always* being started and committed/rolled back for *every* message. It's my understanding that this should only be done if the bean is using CMT and the transaction atttribute is Required.

For BMT or transaction attribute=NOT_SUPPORTED no transaction should be created.

Also

  |  if (activation.getActivationSpec().getAcknowledgeModeInt() == Session.SESSION_TRANSACTED || activation.getActivationSpec()
  |                                                                                                             .getAcknowledgeModeInt() == Session.CLIENT_ACKNOWLEDGE)
  |       {
  |          try
  |          {
  |             message.acknowledge();
  |          }
  |          catch (MessagingException e)
  |          {
  |             log.error("Failed to process message", e);
  |          }
  |       }
  | 

The above code is a nonsense, since a) it's illegal to use CLIENT_ACKNOWLEDGE in a MDB and b) if a session is transacted, message.acknowledge() does nothing anyway.

Also the code in JBMResourceAdapter::createSession seems just plain wrong - it seems to be creating XA sessions when ack mode = auto_ack !! ??

The specification "EJB core contracts and requirements" Chapter 5 should be read properly and the code in the adapter corrected.

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

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



More information about the jboss-dev-forums mailing list