[jboss-jira] [JBoss JIRA] Commented: (JBAS-4945) Messages transfered from DLQ to working queue will never be resent to DLQ

Adrian Brock (JIRA) jira-events at lists.jboss.org
Thu Nov 8 06:36:44 EST 2007


    [ http://jira.jboss.com/jira/browse/JBAS-4945?page=comments#action_12386662 ] 
            
Adrian Brock commented on JBAS-4945:
------------------------------------

There's also a related problem in the SpyConnectionConsumer (the consumer that receives
messages for MDBs) where it isn't calculating the JMSXDeliveryCount at all.

This is fixed by the following patch:

Index: SpyConnectionConsumer.java
===================================================================
--- SpyConnectionConsumer.java  (revision 66725)
+++ SpyConnectionConsumer.java  (working copy)
@@ -50,6 +50,9 @@
 
    /** Whether trace is enabled */
    static boolean trace = log.isTraceEnabled();
+
+   /** Delivered once */
+   static final Integer ONCE = new Integer(1);
    
    // Attributes ----------------------------------------------------
 
@@ -153,6 +156,7 @@
          
          if (waitingForMessage)
          {
+            prepareDelivery(mes);
             queue.addLast(mes);
             queue.notifyAll();
          }
@@ -165,6 +169,25 @@
       }
    }
    
+   /**
+    * Prepare the message for delivery
+    * 
+    * @param message the message
+    * @throws JMSException for any error
+    */
+   void prepareDelivery(SpyMessage message) throws JMSException
+   {
+      Integer delivery = ONCE;
+      Integer redelivery = (Integer) message.header.jmsProperties.get(SpyMessage.PROPERTY_REDELIVERY_COUNT);
+      if (redelivery != null)
+      {
+         int value = redelivery.intValue();
+         if (value != 0)
+            delivery = new Integer(value + 1);
+      }
+      message.header.jmsProperties.put(SpyMessage.PROPERTY_DELIVERY_COUNT, delivery);
+   }
+
    // ConnectionConsumer implementation -----------------------------
 
    public ServerSessionPool getServerSessionPool() throws JMSException
@@ -385,4 +408,4 @@
    // Private -------------------------------------------------------
    
    // Inner classes -------------------------------------------------
-}
\ No newline at end of file
+}


> Messages transfered from DLQ to working queue will never be resent to DLQ
> -------------------------------------------------------------------------
>
>                 Key: JBAS-4945
>                 URL: http://jira.jboss.com/jira/browse/JBAS-4945
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: JMS service
>    Affects Versions: JBossAS-4.0.5.GA
>            Reporter: Mike Clark
>         Assigned To: Adrian Brock
>             Fix For:  JBossAS-5.0.0.Beta3, JBossAS-4.2.3.GA
>
>
> Messages that are retreived from the DLQ have their JMSXDeliveryCount set to 1. Inside org.jboss.ejb.plugins.jms.DLQHander, this leads to the code that redirects failed messages to the DLQ. Starting on line 454, the count gets set to 1, then is decremented to zero. On the next redelivery, the same thing happens again. The JMS_JBOSS_REDELIVERY_COUNT is incremented on each cylce but never gets checked:
>     try
>     {
>         if (msg.propertyExists(PROPERTY_DELIVERY_COUNT)) // Is 1 for a message transferred from DLQ <<<<
>             count = msg.getIntProperty(PROPERTY_DELIVERY_COUNT);
>     }
>     catch (JMSException ignored)
>     {
>     }
>     if (count > 0)
>     {
>         // The delivery count is one too many
>         --count; // Becomes zero for message transferred from DLQ <<<
>     }
>     else if (msg.propertyExists(JMS_JBOSS_REDELIVERY_COUNT))
>         count = msg.getIntProperty(JMS_JBOSS_REDELIVERY_COUNT);
>     else
>     {
>         id = msg.getJMSMessageID();
>         if (id == null)
>         {
>             // if we can't get the id we are basically f**ked
>             log.error("Message id is null, can't handle message");
>             return false;
>         }
>         count = incrementResentCount(id);
>         fromMessage = false;
>     }
>     if (count > max) // Count is always zero for a message that has been transfered from DLQ <<<<
>     {
>         id = msg.getJMSMessageID();
>         log.warn("Message resent too many times; sending it to DLQ; message id=" + id);
>         sendMessage(msg);
>         deleteFromBuffer(id);
>         handled = true;
>     }
> Cheers,
> Mike C. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list