Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Acknowledgement in JMS

 
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a very simple question: when we speak of acknowledgement in JMS what does it actually mean?
Is it acknowledgement from the Message Receiver to the message producer? or is it acknowledgement from the message listener to the JMS container?
 
Ranch Hand
Posts: 66
VI Editor Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Acknowledgement from the listener to the container that the message is received and processed. JMS is asynchronous and so the consumer does not know who the producer is.
 
Stanley Walker
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the reply.
When we are producing a message,we create a queue session with an acknowledgement mode parameter. In this case is the acknowledgement from the container to the message producer?

Also if possible, can you give me a scenario when a message will not be registered with a queue . I want to test what happens when no acknowledgement is received. If it is not asking for much.
 
Prabaharan Gopalan
Ranch Hand
Posts: 66
VI Editor Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Message Acknowledgement has nothing to do with the producer. The Queue Session has Acknowledgement mode as one of it's parameters because you can create consumers/producers alike from a session and the Ack Mode affects only the consumer.

message will not be registered with a queue



Not sure what exactly you mean by that. Are you saying when will a message be *not* sent to the queue, after a producer calls send(..)? The API has the following Exceptions for the send() method:
JMSException - if the JMS provider fails to send the message due to some internal error. Internal error is anything related to your network, port accessibility, provider not running scenarios..
MessageFormatException - if an invalid message is specified.
InvalidDestinationException - if a client uses this method with an invalid destination.
UnsupportedOperationException - if a client uses this method with a MessageProducer that specified a destination at creation time.

And when a message is not acknowledged by the consumer, the JMS provider retains the message and delivers it the next time again, till an acknowledgement is received (unless, the Ack Mode is AUTO_ACKNOWLEDGE in which case, a delivery to the consumer is automatically acknowledged.
 
Stanley Walker
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Prabhaharan. I was wrong in assuming that even during message production the JMS provider acknowledges receipt of a message.
Thank you for all your inputs, it cleared many of my doubts especially

The Queue Session has Acknowledgement mode as one of it's parameters because you can create consumers/producers alike from a session and the Ack Mode affects only the consumer

 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic