WebSphere® MQ Publish/Subscribe uses streams primarily as a way of partitioning the topic name space. Sets of related topics can be grouped together into separate streams. Different security controls can be applied to different streams, and the publishing workload of the broker can be better balanced.
Although WebSphere Message Broker provides more flexible controls for an application to achieve both of these behaviors, the concept of streams is supported for compatibility with MQRFH applications.
The security controls of WebSphere Message Broker allow authorization to be applied to an individual topic level. Also, the publishing workload of the broker can be more easily controlled by creating additional instances of publication message flows that can serve either the same or different input queues.
WebSphere Message Broker allows MQRFH client applications to specify an MQPSStreamName command parameter in their subscriptions and publications. However, the stream name is used only to modify the topic to preserve the partitioning characteristic of WebSphere MQ Publish/Subscribe.
When the stream name that is associated with a message is set to something other than SYSTEM.BROKER.DEFAULT.STREAM, the message is processed as if the topic, or topics, that are mentioned within the message are prefixed with the string "$SYS/STREAM/<streamname>/". That is, a subscription to Topic1 that specifies a stream name of StreamX is processed as if the subscription is to topic "$SYS/STREAM/StreamX/Topic1".
MQRFH2 publishing and subscribing applications can also target stream-related topics, even though they themselves cannot specify a stream name in the messages they send to the WebSphere Message Broker broker. To do this, they must prefix the topics with the appropriate stream prefix.
For example, to subscribe to topic "IBM/Latest" that is published on stream STOCK.STREAM within the WebSphere MQ Publish/Subscribe network, an MQRFH2 subscriber must specify the topic "$SYS/STREAM/STOCK.STREAM/IBM/Latest".
WebSphere MQ Publish/Subscribe allows a stream-related publication to be sent only to a queue having the same name as the stream. However, WebSphere Message Broker allows publishing clients to send their publications to any input queue in a message flow. MQRFH applications choosing explicitly to specify a stream name parameter within a publication can send it to any publication queue being serviced by the WebSphere Message Broker broker. The name of the queue does not have to be the same as the name of the stream. However, this behavior might affect the order in which publications are received. Consider whether this is important for your applications.
Be aware that the order in which publications are received might be different from what you might expect.
Each Publication node has an Implicit Stream Naming property that defaults to true. This default option results in behavior that is identical to that in WebSphere MQ Publish/Subscribe when an MQRFH publication does not contain an explicit stream name. If this property is false, and the publication contains no explicit stream name, SYSTEM.BROKER.DEFAULT.STREAM is assumed.
MQRFH publisher | MQRFH2 publisher | |||
---|---|---|---|---|
default stream | StreamX | default stream | StreamX | |
MQRFH subscriber | S1,P1 | S2,P2 | S1,P3 | S2,P4 |
MQRFH2 subscriber | S3,P1 | S4,P2 | S3,P3 | S4,P4 |