User: chirino 
  Date: 01/12/08 12:21:49

  Modified:    src/main/org/jboss/mq SpyMessageConsumer.java
  Log:
  Changed so that we now add the message to XAResource manager before we call 
onMessages since the
  resource may get elisted IN the onMessage method.  This gives onMessage a chance to 
roll the message back.
  
  Revision  Changes    Path
  1.13      +12 -6     jbossmq/src/main/org/jboss/mq/SpyMessageConsumer.java
  
  Index: SpyMessageConsumer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/SpyMessageConsumer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SpyMessageConsumer.java   2001/11/06 21:10:17     1.12
  +++ SpyMessageConsumer.java   2001/12/08 20:21:49     1.13
  @@ -23,7 +23,7 @@
    * @author     Hiram Chirino ([EMAIL PROTECTED])
    * @author     David Maplesden ([EMAIL PROTECTED])
    * @created    August 16, 2001
  - * @version    $Revision: 1.12 $
  + * @version    $Revision: 1.13 $
    */
   public class SpyMessageConsumer
      implements MessageConsumer, SpyConsumer, Runnable
  @@ -425,6 +425,11 @@
         synchronized ( stateLock ) {
            thisListener = messageListener;
         }
  +      // Add the message to XAResource manager before we call onMessages since the 
  +      // resource may get elisted IN the onMessage method.  This gives onMessage a 
chance to roll the message back.
  +      if ( session.transacted ) 
  +         session.connection.spyXAResourceManager.ackMessage( 
session.currentTransactionId, message );
  +
         if ( thisListener != null ) {
            Message mes = message;
            if ( message instanceof SpyEncapsulatedMessage ) {
  @@ -432,11 +437,12 @@
            }
            thisListener.onMessage( mes );
         }
  -      //ack
  -      if ( session.transacted ) {
  -         session.connection.spyXAResourceManager.ackMessage( 
session.currentTransactionId, message );
  -      } else if ( session.acknowledgeMode == session.AUTO_ACKNOWLEDGE || 
session.acknowledgeMode == session.DUPS_OK_ACKNOWLEDGE ) {
  -         message.doAcknowledge();
  +      
  +      // Should we Auto-ack the message since the message has now been processesed
  +      if ( !session.transacted ) {
  +         if ( session.acknowledgeMode == session.AUTO_ACKNOWLEDGE || 
session.acknowledgeMode == session.DUPS_OK_ACKNOWLEDGE ) {
  +            message.doAcknowledge();
  +      }
         }
      }
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to