aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes AUTO_ACKNOWLEGE still may deliver same message twice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "AUTO_ACKNOWLEGE still may deliver same message twice" Watch "AUTO_ACKNOWLEGE still may deliver same message twice" New topic
Author

AUTO_ACKNOWLEGE still may deliver same message twice

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
Yes it does Sam. However it might not be always possible and sometimes the same message could be redelivered. With AUTO_ACKNOWLEGE mode for example, there is a small gap between the time the message was received and the moment of acknowledgement. If the application fails exactly within that gap, then because the message was delivered, but the acknowledge message wasn�t received (and therefore the message is not removed from the queue) it will be received again next time.
Regards.

--------------------

I think, therefore I exist -- Rene Descartes
Posts: 171 | Registered: Feb 2005 | IP: Logged
Sam Gehouse
ranch hand
Member # 53366

posted April 07, 2005 09:35 AM Profile for Sam Gehouse Email Sam Gehouse Send New Private Message Edit/Delete Post Reply With Quote As you said:
If the application fails exactly within that gap, then because the message was delivered, but the acknowledge message wasn�t received (and therefore the message is not removed from the queue) it will be received again next time.

Is there a solution to that?
In other words, what could be the preferred solution so that the message is NOT delivered MORE than ONCE and ONE TIME ONLY.
Regards,
SG
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
One obvious solution would be to use another acknowledge mode, like DUPS_OK_ACKNOWLEDGE. Another solution would be to use transacted sessions, which will ignore the acknowledge modes and will help developers to define units of work (transactions). Finally one must use appropriate try/catch blocks in order to avoid application failures.
Regards.


I think, therefore I exist -- Rene Descartes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AUTO_ACKNOWLEGE still may deliver same message twice