What are the different ways in which messages are consumed in JMS?

What are the different ways in which messages are consumed in JMS?

Ninja Asked on 19th September 2018 in JMS.
Add Comment
1 Answer(s)
Best answer

Messaging products are inherently asynchronous. However in JMS, messages can be consumed in either of the two ways:

  • Synchronously: A subscriber or a receiver explicitly fetches the message from the destination by calling the receive The receive method can block until a message arrives or can time out if a message does not arrive within a specified time limit.
  • Asynchronously: A client can register a message listener with a consumer. A message listener is similar to an event listener. Whenever a message arrives at the destination, the JMS provider delivers the message by calling the listener’s onMessage method, which acts on the contents of the message.
Ninja Answered on 19th September 2018.
Add Comment