Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

JMS - Duplicate Messages Check  RSS feed

 
Ranch Hand
Posts: 381
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JMS, is it possible to deliver the same message twice/multiple times? If yes, then how can we avoid it - do we have any broker specific property which needs to be set to avoid duplicate messages?
 
Saloon Keeper
Posts: 5128
135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a hypothetical scenario you're wondering about, or an actual problem you've encountered? It sounds like a bug to me.
 
Vaibhav Gargs
Ranch Hand
Posts: 381
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am just thinking about hypothetical scenario. In case, we don't get acknowledgement from the client and hence, i guess broker can send the message again considering it was not delivered.
 
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not hypothetical. This is true with all messaging systems. The (durable) subscriber is always responsible for duplicate detection.

Think about it. The broker delivers the message to the subscriber. The subscriber (along with the whole client application) dies. Then the subscriber comes back (when the application is restarted)... did the subscriber get the message? and if so, did the subscriber processed it? and if so, did it process it to completion?

The messaging environment always choose to resend under these edge conditions -- meaning it will choose to guarantee the delivery over avoiding duplicates.

Henry

PS... Yes, XA transactions would help here, but keep in mind, this is not in common usage -- and not many messaging environments support them.
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!