Quantcast
Channel: Suchith Hegde – Perficient IBM Blog
Viewing all articles
Browse latest Browse all 3

How To: Message Selectors in WMB & WMQ as JMS Publish Subscriber

$
0
0

WebSphere MQ, when used as a JMS provider, can be leveraged to implement one of the widely used architecture patterns, the Pub-Sub model. In this use case, we have a message flow as the service provider that connects to WMQ publisher and another consumer message flow that uses WMQ topics as a subscriber within WebSphere Message Broker. Here message selectors are used as filter criteria for a given topic string. The steps below will guide you through the implementation of the use case.

Create Topic to Publish Messages

1. Create Topic to publish messages: Expand QM (MQ Explorer) -> Select “Topics” -> New -> Topic

New Topic
Create JMS Administered Objects

1. Create initial context under “JMS Administered Objects” ->”Add Initial Context.”

Add Initial Context

2. Under Initial context created above, create Connection Factory and specify the Base Queue Manager.

New Connection Factory 1

New Connection Factory 2

Within the install location, run “JMSAdmin.bat”. In Windows environment you would most likely find it in location below:

C:\Program Files (x86)\IBM\WebSphere MQ\java\bin

In Unix server, you would have to run using the command below.

[mqm@localhost bin]$ ./JMSAdmin -cfg /tmp/JMSAdmin.config

Unix Command

3. Create Destination (Queue/Topic) under Initial Context created in Step 2 and with the same Topic string as we created in Step 1 highlighted below.

JMSTopic - Properties

Unix Command 2

 

Message Flow Configuration

1. Create Publish flow and configure JMSOutput node to specify the Topic.

Publish flow - JMSOutput

Publish flow - JMSOutput 2

Publish flow - JMSOutput 3

2. Optionally, you could specify the Application Property to be used as Message Selector either using ESQL(a) or JMSHeader node(b).

a) 

SET OutputRoot.JMSTransport.Transport_Folders.Application_Properties.SourceSystem = 'LAWSON';

b)

Publish flow - JMSHeader

Publish flow - JMSHeader 2

3. Create Subscription message flow to read messages published on a topic using Message Selectors.

Publish flow - JMSInput

Publish flow - JMSInput 2

Publish flow - JMSInput 3

Publish flow - JMSInput 4

 

Creating Subscriptions Using MQ Explorer

You could also create multiple subscriptions for the same Topic but with different destination queue and message selector: Expand QM (MQ Explorer) -> Select “Subscriptions” -> New -> subscription.

Note: Select previously created Topic, destination Queue name, and message selector when creating the subscription.

New Subscription


How To: Message Selectors in WMB & WMQ as JMS Publish Subscriber was first posted on November 24, 2015 at 7:10 am.

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images