The Publish command message is sent from a publisher to a broker, or from a broker to a subscriber, to publish information on a specified topic or topics.
This message is sent to the input queue of a message flow that contains a Publication node. Authority to put a message onto this queue, and to publish on the specified topic or topics, is necessary.
If the user has authority on some, but not all, topics, only those topics are published; a warning response indicates which topics are not published.
If a subscriber has any matching subscriptions, the broker forwards the Publish message to the subscriber queues defined in the corresponding Register Subscriber command messages.
See Broker Response message for details of the message descriptor (MQMD) parameters needed when sending a command message to the broker, and used when a broker forwards a publication to a subscriber.
The broker forwards the Publish message to other brokers in the network that have matching subscriptions, unless it is a local publication.
Publication data, if any, is included in the body of the message. The data can be described in an <mcd> folder in the NameValueData field of the MQRFH2 header.
This property must be specified.
This property must be specified, and can optionally be repeated for as many topics as needed.
This property should not be included in a publication message sent to the broker but is added automatically to publication messages by the broker before those messages are sent to any appropriate subscribers. The value of the <SubPoint> property is the value of the Subscription Point attribute of the Publication node that is handling the publishing.
The broker is to retain a copy of the publication. If this option is not set, the publication is deleted as soon as the broker has sent the publication to all its current subscribers.
(Can only be set by a broker.) This publication has been retained by the broker. The broker sets this option to notify a subscriber that this publication was published earlier and has been retained, provided that the subscription has been registered with the InformIfRetained option. It is set only in response to a Register Subscriber or Request Update command message. Retained publications that are sent directly to subscribers do not have this option set.
This option tells the broker that this publication should not be sent to other brokers. All subscribers that registered at this broker receive this publication if they have matching subscriptions.
This option allows simpler processing of conference-type applications, where a publisher is also a subscriber to the same topic. It tells the broker not to send the publication to the publisher's subscriber queue even if it has a matching subscription. The publisher's subscriber queue consists of its QMgrName, QName, and optional CorrelId, as described below.
The CorrelId in the MQMD (which must not be zero) is part of the publisher's subscriber queue, in applications where the publisher is also a subscriber.
All options take their default values. This has the same effect as omitting the publication options property. If other options are specified at the same time, None is ignored.
The default, if this property is omitted, is that no publication options are set.
YYYYMMDDHHMMSSTH
using Universal Time. This information is not checked by the broker before being sent to the subscribers.
It should be incremented by 1 with each publication. However, this is not checked by the broker, which merely transmits this information to subscribers.
If publications on the same topic are published to different interconnected brokers, it is the responsibility of the publishers to ensure that sequence numbers, if used, are meaningful.
If this property is omitted, the default is the ReplyToQMgr name in the message descriptor (MQMD). If the resulting name is blank, it defaults to the name of the broker's queue manager.
If this property is omitted, the default is the ReplyToQ name in the message descriptor (MQMD), which must not be blank if OtherSubsOnly is set.
Here are some examples of NameValueData for a Publish command message.
<psc> <Command>Publish</Command> <Topic>Sport/Soccer/Event/MatchStarted</Topic> </psc>
<psc> <Command>Publish</Command> <PubOpt>RetainPub</PubOpt> <Topic>Sport/Soccer/State/LatestScore/Team1 Team2</Topic> </psc>