aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Significance of acknowledgement mode when creating JMS session 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 "Significance of acknowledgement mode when creating JMS session" Watch "Significance of acknowledgement mode when creating JMS session" New topic
Author

Significance of acknowledgement mode when creating JMS session

Tomasz Wolak
Greenhorn

Joined: May 06, 2008
Posts: 10
Hi:
I am pretty sure I know what the answer is but I would like to have a confirmation. When creating a JMS session for the purpose of using the session to create message producer: is there any significance of specifying what the acknowledgment mode should be? My understanding is that the message is stored by JMS provider upon exit from the publish(), send() methods and regardless of what the mode was set to be. In which case the acknowledgment mode is message consumer only concept?
Thanks for you input!
Tomek
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4241
    
    7

[Moved because I don't think JMS is really beginners material!]
ntumba lobo
Ranch Hand

Joined: Oct 21, 2008
Posts: 180
Yes the producers set the acknowledgement of the messages which is then used by the consumers and JMS server.
Message acknowledgement tells you what you consider a message successfully received and processed to be then removed from the JMS server.

In auto acknowledgement if the consumer onMessage() method completes without error the message is considered received and processed successfully, it'll be then removed from the JMS server.

In manual acknowledgement, the consumer has to make a method call to say "OK I have done successfully my work with the message". However even without technical error the consumer can choose
not to acknowledge the message because for example some business conditions were not met to process the message. In that case the onMessage() completes without error but the message says in the JMS server.


SCJP 5 , SCWCD 5, SCEA 5
Tomasz Wolak
Greenhorn

Joined: May 06, 2008
Posts: 10
Thanks!

I understand the differences of acknowledgment types in the consumer of the message, and the significance of the setting the acknowledgment type during creation of the consumer. I just fail to see it's significance in message producers: as far as I see it there is no impact of the acknowledgment type when creating the producer: regardless of the type of acknowledgment selected there is no need to change the code or expected different behavior. For example consumer CLIENT_ACKNOWLEDGE requires the message to be explicitly acknowledged by using ObjectMessage acknowledge() method. As far as I see it producer requires no such action: in fact the message receipt by JMS provider is guaranteed upon successful completion of the send()/publish() method.

If in fact my assumption is corrected (i.e. acknowledgment type has no impact on the message producer) then I think I would rather see have two different ways creating the session object: one for consumers who would like to control both the message acknowledgment and transaction boundaries and second one for producers whose only option is whether the is transacted or not.

Cheers!
Tomek
Prankur Pahuja
Greenhorn

Joined: Feb 07, 2014
Posts: 2
Did you get any further clarifications on it? is it possible to capture acknowledgement at producer end? Or this acknowledgement is internal and not available to the program
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Significance of acknowledgement mode when creating JMS session
 
Similar Threads
JMS acknowledgement modes
WLS JMS ack options
Need help in MDB
MDB and acknowledge-mode
JMS:Difference between CLIENT and AUTO_ACKNOWLEDGE modes