Message Consumption
How will a message from JMS be Consumed?
A JMS message can be consumed by created MessageConsumer object from session:
session.createConsumer() MessageConsumer
There are two ways of Consumption:
1. Synchronous
2. Asynchronous (usual)
1. Synchronous: The thread would wait for the message to get consumed.
a. messageConsumer.recieve(): Receives the next message that arrives (with timeout option)
b. messageConsumer.recieveNoWait(): Recieves the message if is available immediately, null otherwise
2. Asynchronous: messageConsumer.setMessageListener(). MessageListener inteface has onMessage() method