Chapter 3. Messaging with JMS Transport

In this chapter, we will cover:

  • Sending a message to a JMS queue/topic
  • Changing JMS Transport message headers and properties at runtime
  • Consuming messages from a JMS queue
  • Consuming messages from a topic with nondurable or durable subscription
  • Consuming messages from a JMS queue/topic selectively
  • Accessing JMS Transport message headers and properties in message flow
  • Using request-response messaging with JMS
  • Using QBrowser Admin GUI for accessing JMS queues/topics
  • Testing JMS with soapUI

Introduction

The Java Message Service (JMS) specification defines a standard API for accessing messaging systems. It allows applications to consume and send messages to any JMS-compliant messaging server. JMS supports two distinct message models:

  • point-to-point – The message producer (sender) creates a message and sends it to destination known as a queue. Message consumers (receivers) process messages placed in a queue. Each message can only be processed by one receiver and they are by default delivered in first-in-first-out (FIFO) order. This is also known as point-to-point messaging model.
  • publish-subscribe – The message producer (sender) creates a message and sends it to a destination known as a topic. Messages sent or published to a topic are delivered to active consumers, known as subscribers. Subscribers have indicated their interest by subscribing to a topic. Subscriptions can either be durable or nondurable. A nondurable subscription only last as long as the subscriber is connected to JMS. A durable subscriber can disconnect and will get all messages published while disconnected as soon as he reconnects. This is also known as publish-subscribe messaging model.

WebLogic Server provides an enterprise-class messaging system called WebLogic JMS that completely supports the JMS API and makes it easy to use JMS from any applications.

Oracle Service Bus integrates very well with JMS. Using WebLogic JMS from an OSB project is very easy. The recipes in this chapter show the basic working with JMS from OSB and how to browse for the messages which are in a queue or topic. This is helpful in case of testing. In Chapter 10, Reliable communication with OSB, we cover how to use JMS to implement reliable messaging.

First let's check which queues exist in the OSB Cookbook standard environment. In the WebLogic console perform the following steps:

  1. Expand the Services node in the Domain Structure tree.
  2. Click the Messaging node and in the details view click on JMS Modules.
  3. Click on OsbCookbookResources.
    Introduction

We can see the different queues, topics, and the connection factories available in the OSB Cookbook standard environment of our cookbook, created in the Preface chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset