A stream is a method of topic partitioning used by WebSphere MQ Publish/Subscribe applications. Sets of related topics are grouped together into separate streams.
By using streams, different security controls can be applied to different groups of topics, and the publishing workload of the broker can be better balanced.
Although WebSphere Message Broker provides other ways for an application to achieve both of these behaviors, the concept of streams is supported for compatibility with MQRFH applications.
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.
If the name of a stream associated with a message is not SYSTEM.BROKER.DEFAULT.STREAM, the message is processed as if the topic, or topics, mentioned within the message had been prefixed with the string "$SYS/STREAM/<streamname>/". For example, a subscription to Topic1 that specifies a stream name of StreamX is processed as if the subscription had been made 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, an MQRFH2 subscriber must specify topic "$SYS/STREAM/STOCK.STREAM/IBM/Latest" to subscribe to topic "IBM/Latest" that is published on stream STOCK.STREAM within the WebSphere MQ Publish/Subscribe network.
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.
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.
The options that are available to both MQRFH and MQRFH2 client applications that publish messages are shown in the following table; the table shows the options for both the default stream and an example stream name of StreamX.
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 |
In a WebSphere MQ Publish/Subscribe network, a broker does not have to support the same set of streams as its neighbors. If a broker does not support a stream that is supported by one of its neighboring brokers, publications associated with that stream are not available to clients at that broker.
When an WebSphere Message Broker broker joins the network, it supports all the streams of its neighboring WebSphere MQ Publish/Subscribe brokers. This means that clients of the WebSphere Message Broker broker can target publications for any stream supported by any of its WebSphere MQ Publish/Subscribe neighbors.
However, to make these publications available, you must define the stream queues, and define and deploy the message flows that support them, to the WebSphere Message Broker broker.
A heterogeneous network
The default stream queue SYSTEM.BROKER.DEFAULT.STREAM is always supported by every broker in an WebSphere MQ Publish/Subscribe network, and must be defined at every WebSphere Message Broker broker in a heterogeneous network. At each broker, you must define and deploy a message flow to service this queue.
When a WebSphere Message Broker broker is integrated into an WebSphere MQ Publish/Subscribe network, and links two or more WebSphere MQ Publish/Subscribe brokers that share common streams, you must define the common stream queues, and define and deploy the message flows that service them, to the WebSphere Message Broker broker.
For example, the WebSphere Message Broker broker NEWBROKER must have a stream queue defined for BULLETIN.STREAM. It must also have a message flow defined and deployed to provide a publication service for that queue.
When an WebSphere MQ Publish/Subscribe broker is migrated to an WebSphere Message Broker broker (using the migmqbrk command), the streams supported at the time of the migration are replicated exactly in the WebSphere Message Broker broker. No changes can be made subsequently; that is, no streams can be added to, or removed from, this replicated set. The migration is not complete until you have created and deployed message flows that process all these streams.