[jboss-user] [Messaging, JMS & JBossMQ] - Re: JMS msg get redelivered although setting retry to 0

adrian@jboss.org do-not-reply at jboss.com
Wed Oct 17 09:26:04 EDT 2007


Ok, I think I understand what the problem is.

The issue is that the failover node doesn't know that the message was already
delivered. The node (the original node) that did know has crashed.

The problem comes because the failover node uses the transaction log
to recover the state to the "last known good state" of the message
(which was in your case before the message was delivered to the MDB).

The only way I can see to fix the problem, would be to update the
redelivered status and redelivery count of the message in the database
before the message is delivered to the client (instead of when the server
receives the NACK/rollback - which it won't do if the server crashes
- it will do it if the problem is just the client loosing connectivity).

i.e. in BasicQueue
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/trunk/jbossmq/src/main/org/jboss/mq/server/BasicQueue.java?revision=61447&view=markup

This would involve moving the code in "nackMessage()"

  |      try
  |      {
  | ...
  | 
  |          // Set redelivered, vendor-specific flags
  |          message.invalidate();
  |          // Update the persistent message outside the transaction
  |          // We want to know the message might have been delivered regardless
  |          if (message.isPersistent())
  |             server.getPersistenceManager().update(message, null);
  |       }
  |       catch (JMSException e)
  |       {
  |          log.error("Error setting redelivered " + message, e);
  |       }
  |    }
  | 

To the setupMessageAcknowledgement() method instead (which is always
invoked before delivering the message).

But, this would obviously have a deterimental effect on performance
since it would always update persistent messages with the redelivered status
in the database regardless of whether it is was actually redelivered or not
(if it doesn't get redelivered, i.e. it is ACKed/committed, it will be deleted so the
early change in status is irrelevant).

Do you want to try that patch?

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

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



More information about the jboss-user mailing list