Java Reference
In-Depth Information
There are two messaging domains that can be used when working with JMS, the
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 using the PTP messaging domain use message queues as
their JMS destinations, where applications using pub/sub use message topics.
The following diagram illustrates the JMS architecture:
When working with JMS we need to obtain a reference to a connection factory, either
via JNDI or via dependency injection. From this connection factory we can create a
JMS session, that in turn can be used to create JMS messages.
When developing code to send messages to a JMS destination, we need to create a
JMS message producer from the JMS session. In turn, we use this message producer
to send messages to the destination.
When developing code to receive messages from a JMS destination, we need to
create a message consumer from the JMS session. We can then use this message
consumer to retrieve messages from our JMS destination.
Creating the project and JMS resources
We will be creating a new Enterprise Application project for our example.
Search WWH ::

Custom Search