1 Reply Latest reply on Mar 15, 2006 12:15 PM by Bogdan Daniliuc

    Local and remote resources in XAtransaction

    Bogdan Daniliuc Newbie

      I'm trying to use two resources in the same XA transaction: a local resource and a remote resource. For example:

      public class FileProcessor implements MessageListener {
      protected QueueConnectionFactory factory;
      protected QueueConnection cnn;
      protected Queue myQueue;
      protected EntityManager em;
      public void init() {
       Hashtable<String, String> params = new Hashtable<String, String>();
       params.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       params.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
       params.put("java.naming.provider.url", "remotehost:remoteport");
       InitialContext ic = new InitialContext(params);
       factory = (QueueConnectionFactory) ic.lookup("UIL2XAConnectionFactory");
       myQueue = (Queue) ic.lookup("queue/myQueue");
       cnn = factory.createQueueConnection();
      public void onMessage(javax.jms.Message msg) {
      private void dbUpdate(object){
      private void sendNotifications(object){
       sess = cnn.createQueueSession(true, 0);
       sender = sess.createSender(myQueue);

      In the above code, the result of dbUpdate will be visible only after onMessage ends succesfully, but the result of sendNotifications will be visible when sendNotifications ends, i.e the notifications will be send before the objects are in database.

      Is it something wrong with the above code? Is this behaviour unsupported or is this a bug?