Messaging with JMS and
Java Message Service ( JMS ) is a standard Java EE messaging API that allows loosely
coupled, asynchronous communication between Java EE components.
NetBeans includes good support to aid us in creating applications that take
advantage of the JMS API, generating most of the JMS-specific code and
allowing us to focus on the business logic of our application.
We will cover the following topics in this chapter:
• Introduction to JMS
• Creating JMS resources from NetBeans
• Implementing a JMS message producer
• Consuming JMS messages with message-driven beans
Introduction to JMS
JMS is a standard Java EE API that allows loosely coupled, asynchronous
communication between Java EE components. Applications that take advantage of
JMS do not interact with each other directly; instead, JMS message producers send
messages to a destination (JMS queue or topic) and JMS consumers receive messages
from those destinations.
There are two messaging domains that can be used when working with JMS:
point-to-point (PTP) messaging, in which a JMS message is processed by only one
message receiver, and publish/subscribe ( pub/sub ) messaging, in which all message
receivers subscribed to a specific topic receive and process each message for said
topic. JMS applications that use the PTP messaging domains use message queues as
their JMS destinations, whereas applications that use pub/sub use message topics.