Publish/subscribe message properties

Several message properties relate to IBM MQ publish/subscribe messaging.


PubAccountingToken

This is the value that will be in the AccountingToken field of the Message Descriptor (MQMD) of all publication messages matching this subscription. AccountingToken is part of the identity context of the message. For more information about message context, see Message context. For more information about the AccountingToken field in the MQMD, see AccountingToken.


PubApplIdentityData

This is the value that will be in the ApplIdentityData field of the Message Descriptor (MQMD) of all publication messages matching this subscription. ApplIdentityData is part of the identity context of the message. For more information about message context, see Message context. For more information about the ApplIdentityData field in the MQMD, see ApplIdentityData.

If the option MQSO_SET_IDENTITY_CONTEXT is not specified, the ApplIdentityData which will be set in each message published for this subscription is blanks, as default context information.

If the option MQSO_SET_IDENTITY_CONTEXT is specified, the PubApplIdentityData is being generated by the user and this field is an input field which contains the ApplIdentityData to be set in each publication for this subscription.


PubPriority

This is the value that will be in the Priority field of the Message Descriptor (MQMD) of all publication messages matching this subscription. For more information about the Priority field in the MQMD, see Priority.

The value must be greater than or equal to zero; zero is the lowest priority. The following special values can also be used:

  • MQPRI_PRIORITY_AS_Q_DEF - When a subscription queue is provided in the Hobj field in the MQSUB call, and is not a managed handle, then the priority for the message is taken from the DefProirity attribute of this queue. If the queue so identified is a cluster queue, or there is more than one definition in the queue-name resolution path, the priority is determined when the publication message is put to the queue as described for Priority in the MQMD. If the MQSUB call uses a managed handle, the priority for the message is taken from the DefPriority attribute of the model queue associated with the topic subscribed to.
  • MQPRI_PRIORITY_AS_PUBLISHED - The priority for the message is the priority of the original publication. This is the initial value of this field.


SubCorrelId

Attention: a correlation identifier can only be passed between queue managers in a publish/subscribe cluster, not a hierarchy.

All publications sent to match this subscription will contain this correlation identifier in the message descriptor. If multiple subscriptions use the same queue to get their publications from, using MQGET by correlation ID allows only publications for a specific subscription to be obtained. This correlation identifier can either be generated by the queue manager or by the user.

If the option MQSO_SET_CORREL_ID is not specified, the correlation identifier is generated by the queue manager and this field is an output field which contains the correlation identifier which will be set in each message published for this subscription.

If the option MQSO_SET_CORREL_ID is specified, the correlation identifier is being generated by the user and this field is an input field which contains the correlation identifier to be set in each publication for this subscription. In this case, if the field contains MQCI_NONE, the correlation identifier which will be set in each message published for this subscription will be the correlation identifier created by the original put of the message.

If the option MQSO_GROUP_SUB is specified and the correlation identifier specified is the same as an existing grouped subscription using the same queue and an overlapping topic string, only the most significant subscription in the group is provided with a copy of the publication.


SubUserData

This is the subscription user data. The data provided on the subscription in this field will be included as the MQSubUserData message property of every publication sent to this subscription.


Publication properties

Table 1 lists the publication properties that are provided with a publication message.

We can access these properties directly from the MQRFH2 folder, or retrieve them using MQINQMP. MQINQMP accepts either the property name or MQRFH2 name as the name of the property to inquire on.

Table 1. Publication properties
Property name MQRFH2 name Type Description
MQTopicString mqps.Top MQTYPE_STRING Topic string
MQSubUserData mqps.Sud MQTYPE_STRING Subscriber user data
MQIsRetained mqps.Ret MQTYPE_BOOLEAN Retained publication
MQPubOptions mqps.Pub MQTYPE_INT32 Publication options
MQPubLevel mqps.Pbl MQTYPE_INT32 Publication level
MQPubTime mqpse.Pts MQTYPE_STRING Publication time
MQPubSeqNum mqpse.Seq MQTYPE_INT32 Publication sequence number
MQPubStrIntData mqpse.Sid MQTYPE_STRING String/Integer data added by the publisher
MQPubFormat mqpse.Pfmt MQTYPE_INT32 Message format:

  • MQRFH1
  • MQRFH2
  • PCF