Summary: Basic JMS API Usage

Basic JMS Workflow

  1. Obtain/create a ConnectionFactory instance.
  2. Create a Connection with the ConnectionFactory.
  3. Create a Session with the Connection.
  4. Obtain/create a Destination (Topic or Queue).
  5. Message production:
    1. Create MessageProducers with the Session and the destination.
    2. Create a Message with the Session.
    3. Send the Message with the MessageProducer.
  6. Message Consumption:
    1. Create MessageConsumers with the Session and the destination.
    2. Enable connection message consumption by calling the Connection.start() method.
    3. For synchronous consumption, call the MessageConsumer.receive() method.
    4. For asynchronous consumption, set the MessageConsumer MessageListener, and implement the onMessage() method.
  7. When the application finishes, release all resources by closing the connection.

Using Unified Messaging Model (JMS 1.1)

Click to see the code example:

Using Separate Domains (JMS 1.0.2)

Publish/Subscribe

Click to see the code example:

Point to Point

Click to see the code example:

GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence