Publish/Subscribe Messaging Overview
Publish/subscribe is the messaging oriented equivalent of the object-oriented observer design pattern. In publish/subscribe messaging, a sender application creates a message containing the information it wants to send and assigns it a topic that denotes the subject of the information. This message is called a publication. WMQ receives the publication, recognizes the topic, and then distributes the publication to interested applications.
Publisher (information producer)
In this component generates messages (publications) under a certain subject (topic) and sends the publications to a WMQ queue manager. A publisher knows nothing about the recipient(s) of the information.
Subscriber (information consumer/receiver)
In this component registers interest in a certain topic(s) with a WMQ queue manager. It also specifies its subscription queue name; that is, the queue where it wants to receive the messages related to this topic. The subscriber knows nothing about the information publishers(s). A publications router: In this component passes messages from publishers to topic subscribers. Earlier WMQ versions required a broker component on top of a queue manager to enable publish/subscribe. The broker maintained topics and subscriptions, and it routed publications. The queue manager is now responsible for topics, subscriptions, and routing publications.
Publish/subscribe access controls
A publish/subscribe system can have many publishers and many subscribers, and often, two or more queue managers communicating with one another. Also, an application can be both a publisher and a subscriber.
Publish/Subscribe using MQ Explorer
1.Create a Queue Manager: 2.Create the Queue manager name as 'QM'. 3.Create a pub sub topic called 'NEWS' with topic string: NEWS, using WebSphere MQ Explorer.
Create a New Topic
1.Right-click on Topics and then select New –> Topic to start the "News" wizard. 2. Type “News” as the topic name. This represents the WMQ administrative object used to manage the topic.
3. Click Next. 4. On the topic properties page, type “News” in the Topic string field. This string is used to refer News topic. 5. Click on Finish. 6. Follow the below steps to create some more “Topics name” and “Topic Strings”.
Creating a Subscription Queue Set up NEWS publications to be delivered to Subscription queues. Create two queues for the 'NewsQ' and 'SportsQ' applications. Create a Subscription In order to receive a topic's publications, subscribers have to register interest in the topic. They use subscriptions to accomplish this.To create subscriptions pro-grammatically or through MQ Explorer follow the below steps. In Queue manager “QM”, right click on Subscriptions---->New---> Subscription and name it as “Sub”. Click on Next. Click on 'General' option on the left panel, on the right hand side click on 'Select' button to select the Topic Name as showed above. Click on “OK” Define the Topic String based on the Topic name along with Destination Queue name. Create the another Subscription name as 'Sub2' with same topic name and topic string as given in 'Sub1' define queue name as 'SportsQ' in 'Sub2'. Test for Publish/Subscribe Setup Perform the following steps to verify you have correctly completed the setup for the News topic
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.