| home / infca / MQ Pub/Sub v7 (navigation links) | . |
| Pub | Sub | App | run a sample | Monitor pub/sub | Misc | Links | End |
Publish/Subscribe is a term used to define an application model in which the provider of some information is decoupled from the consumers of that information.
Publishers and subscribers are applications that send and receive messages (publications) using the publish/subscribe method of messaging. Publishers and subscribers are decoupled from one another so that publishers do not know the destination of the information that they send, and subscribers do not know the source of the information that they receive.
The provider of the information is called a publisher. Publishers supply information about a subject without needing to know anything about the applications that are interested in the information.
The consumer of the information is called a subscriber. The subscriber decides what information it is interested in, and then waits to receive that information. Subscribers can receive information from many different publishers, and the information they receive can also be sent to other subscribers.
WebSphere MQ V7 queue managers use a Pub/Sub Engine instead of a broker to control the interactions between publishers and subscribers. The Pub/Sub Engine receives messages from publishers, and subscription requests from subscribers. The Pub/Sub Engine's job is to route the published data to the target subscribers.
mq v7.5 publib + "Publishers and subscribers"
The publisher generates a message that it wants to publish and defines the topic of the message.
A subscriber registers a request for a publication by specifying one of the following items:
Non valid topic names :
In previous versions, publish/subscribe messaging was controlled using a command message interface.
This interface is deprecated in Version 7.0 publish/subscribe.
Instead, publish/subscribe messaging is now controlled using new function in the WebSphere MQ API
and as a result, publish/subscribe messaging is much more consistent with point-to-point messaging.
This new way of doing publish/subscribe messaging is documented in the main body of this section of the information center.
Applications written using previous versions of WebSphere MQ publish/subscribe that make use of the command message interface
are encouraged to move to the new WebSphere MQ publish/subscribe API.
However, the command message interface continues to be supported on all platforms (including z/OS).
If you are already a user of publish/subscribe
you can continue to use your current configuration after installing WebSphere MQ Version 7.0
without making extensive changes to your applications or configuration.
Similarly, JMS applications do not have to be modified,
although if you do not chose to use the new Version 7.0 publish/subscribe
you will not benefit from the simplified administration that is now available when using WebSphere MQ as the provider.
Since the command message interface method of doing publish/subscribe is still supported in Version 7.0 using the PSMODE function,
this interface continues to be documented in the WebSphere MQ Version 7.0 library.
More detail in those links
An application that needs to publish a message about a specific topic can do so by opening that topic and putting a message to it. There is very little difference between an application that opens a queue then puts a message to it, and one that opens a topic to put a message to it, so the application code should look very familiar to you.
If you wish to use publish/subscribe with WebSphere MQ V7 you do not require any topic objects to be defined. You can in fact go right ahead and use a topic string directly in your application. You do this by placing your topic string in the ObjectString field.
TMM42
The publisher can send a Register Publisher command message to the broker's control queue SYSTEM.BROKER.CONTROL.QUEUE to indicate that a publisher will be, or is capable of, publishing data on one or more specified topics.
An application that wants to register an interest in information about a certain topic needs to subscribe to that topic. This can be done using the MQ API verb MQSUB. MQSUB can be thought of rather like MQOPEN. It details the resource you wish to use, and it is the point where security checks are done.
TMM42
Subscriber applications need to register their interest in receiving publications with a broker. Send the Register Subscriber command message to the SYSTEM.BROKER.CONTROL.QUEUE to register as a subscriber.
See sending and receiving test publications on a topic object folder (using Explorer)
The steps are :
Any attribute that is set to ASPARENT uses the attribute as defined by the parent topic of this topic. This action is repeated up the topic tree as far as the root topic, SYSTEM.BASE.TOPIC is found. See Topic trees
Read writing publish/subscribe applications :
We need 2 queue managers :
And their objects :
Using DISPLAY TPSTATUS TYPE(SUB) you can see the details of the current publishers on this topic string. One of the attributes returned is the Active Connection ID (ACTCONN) which links to DISPLAY CONN which shows you the details about that specific application. The Subscription ID (SUBID) links to DISPLAY SBSTATUS where we will see a single subscription with that ID since the perspective of that display is the subscription.
DISPLAY SBSTATUS which shows the run-time status of a subscription. DISPLAY SUB is slightly different it shows the more static attributes of the subscription, whether it was created using a DEFINE SUB command or an MQSUB call in an application.
TMM42
Queues and topics are interchangable in MQ v7. You can have the app put the message to a Topic that has two subscriber queues for the receivers, without changing the apps.
Define a TOPIC that acts as the destination of the sending app and two subscriptions to the "real" destination queues.
Another seq: App A is putting to a local q called Q1. App B is pulling from Q1. You have MQ 7 and want to duplicate the messages but do not want to change the sending or receiving app code.
The only change in the original setup is that App A puts to Q1Alias instead of Q1. App A and App B don't know they are using Pub Sub. The subscriptions are created by the MQ Admin using admin commands.
|
|
|
|
Updated 20150904
|
|