Types of messaging
There are two types of messaging domains to be chosen from, as per the requirement:
Point-to-point messaging:
Each message has only one consumer
There is no timing dependency
Publish-Subscribe messaging:
Each message has many consumers
Messages have a timing dependency - when an application sends a message to the messaging agent, the consumer needs to subscribe and be active to receive the messages
Message consumers
These are the ways of consuming messages provided by JMS API:
Message listeners
They provide an asynchronous messaging model
Listeners are like event watchers/listeners; whenever a message is available, the listener ensures that it reaches its destination
Listeners will call the
onMessage()
method
The
receive()
methodIt provides a synchronous messaging
model()
Messages are consumed by explicitly calling the
receive()
method from the connection factory
Message structure
A message consists of three parts:
Header: This contains information about the destination and timestamp...