Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AUTO_ACKNOWLEDGE JMS Message Removal  RSS feed

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would like to clarify.
After a message is received from queue using simple P2P java class (e.g. MessageReceiver.java) using either AUTO_ACKNOWLEDGE or DUPS_ACKNOWLEDGE, the message is also removed from that queue?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kevin Mest
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
Is there any other scenario where the received message would remain on the queue? I'm testing SonicMQ, and I have my session initialized with AUTO_ACKNOWLEDGE. However, when I read a message from the queue, the message remains. (I even tried message.acknowledge(,) even though I shouldn't need to).

Interestingly, if I consume the message from the test client provided by Sonic, it gets removed as expected.

Any ideas?

thanks,
--K
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!