JMS - Java Message Service

The Java Message Service provides a message queue implementation in full J2EE implementations such as JBoss and Apache Geronimo.

Services subscribe to the JMS as consumers, and then receive notifications as messages are published (added) to the message queue.

For example, with 2 services, this works as follows.

Service A requires a certain action to take place, such as sending an email. It publishes a message to the queue. (Example: a mail-request message).

Service B is responsible for sending emails. When the message is added to the queue by Service A, it receives a notification from JMS because it is registered as a consumer for mail-request messages (ie: it is listening for messages of this type).

Service B then consumes (takes) the message, and sends the email. It then publishes a mail-sent message to the queue stating that the mail send has been completed.

Service A is registered as a consumer for mail-sent responses, so when Service B publishes the mail-sent message, JMS sends a notification to Service A.

Service A then consumes the mail-sent response and reports that the mail has been sent to the user.

JMS provides a flexible method for scaling a large system. As the system grows, services can be moved to other machines, all communicating with the JMS service.

See Also:

metawerx specific

referring pages