• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Transactions in JMS

 
Ranch Hand
Posts: 431
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going through the transaction feature supported by JMS which is provided through Transacted Session. I am just wondering how does this work internally. What happens to the message:

1. When the message is removed from queue?

2. If there is a failure, then what will happen to the message?

3. If there is a success, then what will happen to the message?

4. Is there any scenario where the message will be delivered to more than one consumer?
 
Sheriff
Posts: 21997
107
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. When the message is acknowledged. This can happen because the transaction completes successfully, or by an explicit call in non-transacted systems.

2. I think it depends on the message broker, but mostly it is free for reassignment to another consumer (or the same one), which means it will get retried. After a few errors it gets sent to the so-called dead letter queue (DLQ).

3. It will be gone from the system.

4. If processing the message fails, the message will usually get retried, and therefore delivered to more than one consumer (but only one at a time). That means that consumers must make sure that all work they do is rolled back upon failure, or they are capable of handling duplicate messages. No two consumers will ever be able to successfully process a message and report success.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic