• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Significance of acknowledgement mode when creating JMS session

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Tomasz Wolak
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
see https://coderanch.com/t/621703/EJB-JEE/java/JMS-acknowledgment-mode-posting-message
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic