[IBM i]

CRTMQMSUB (Create MQ Subscription)

Where allowed to run
All environments (*ALL)
Threadsafe
Yes

The Create MQ Subscription (CRTMQMSUB) command creates a new MQ subscription, specifying those attributes that are different from the default.

Parameters

Table 1. Command parameters
Keyword Description Choices Notes
SUBNAME Subscription name Character value Required, Key, Positional 1
MQMNAME Message Queue Manager name Character value, *DFT Optional, Key, Positional 2
REPLACE Replace *NO, *YES Optional, Key, Positional 3
TOPICSTR Topic string Character value, *NONE, *SYSDFTSUB Optional, Positional 4
TOPICOBJ Topic object Character value, *NONE, *SYSDFTSUB Optional, Positional 5
DEST Destination Character value, *SYSDFTSUB Optional, Positional 6
DESTMQM Destination Queue Manager Character value, *NONE, *SYSDFTSUB Optional, Positional 7
DESTCRRLID Destination Correlation Id Character value, *NONE, *SYSDFTSUB Optional, Positional 8
PUBACCT Publish Accounting Token Character value, *CURRENT, *SYSDFTSUB Optional, Positional 9
PUBAPPID Publish Application Id Character value, *NONE, *SYSDFTSUB Optional, Positional 10
SUBUSER Subscription User Id Character value, *CURRENT, *SYSDFTSUB Optional, Positional 11
USERDATA Subscription User Data Character value, *NONE, *SYSDFTSUB Optional, Positional 12
SELECTOR Selector String Character value, *NONE, *SYSDFTSUB Optional, Positional 13
PSPROP PubSub Property *SYSDFTSUB, *NONE, *COMPAT, *RFH2, *MSGPROP Optional, Positional 14
DESTCLASS Destination Class *SYSDFTSUB, *MANAGED, *PROVIDED Optional, Positional 15
SUBSCOPE Subscription Scope *SYSDFTSUB, *ALL, *QMGR Optional, Positional 16
VARUSER Variable User *SYSDFTSUB, *ANY, *FIXED Optional, Positional 17
REQONLY Request Publications *SYSDFTSUB, *YES, *NO Optional, Positional 18
PUBPTY Publish Priority 0-9, *SYSDFTSUB, *ASPUB, *ASQDEF Optional, Positional 19
WSCHEMA Wildcard Schema *SYSDFTSUB, *TOPIC, *CHAR Optional, Positional 20
EXPIRY Expiry Time 0-999999999, *SYSDFTSUB, *UNLIMITED Optional, Positional 21

Subscription name (SUBNAME)

The name of the new MQ subscription to be created.

The possible values are:

subscription-name
Specify a maximum of 256 bytes for the subscription name.

Note: Subscription names of greater than 256 bytes can be specified using MQSC.

Message Queue Manager name (MQMNAME)

Specifies the name of the Queue Manager.

The possible values are:

*DFT
Use the default Queue Manager.
queue-manager-name
The name of a Queue Manager.

Replace (REPLACE)

If a subscription with the same name already exists, this specifies whether it is replaced.

The possible values are:

*NO
This subscription does not replace any existing subscription with the same name or subscription identifier. The command fails if the subscription already exists.
*YES
Replace the existing subscription. If there is no subscription with the same name or subscription identifier, a new subscription is created.

Topic string (TOPICSTR)

Specifies the topic string associated with this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
topic-string
Specify a maximum of 256 bytes for the topic string.

Note: Topic strings of greater than 256 bytes can be specified using MQSC.

Topic object (TOPICOBJ)

Specifies the topic object associated with this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
topic-object
Specify the name of the topic object.

Destination (DEST)

Specifies the destination queue for messages published to this subscription.

The possible values are:

destination-queue
Specify the name of the destination queue.

Destination Queue Manager (DESTMQM)

Specifies the destination queue manager for messages published to this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
destination-queue-manager
Specify the name of the destination queue manager.

Destination Correlation Id (DESTCRRLID)

Specifies the correlation identifier for messages published to this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
destination-correlation-identifier
Specify the 48 character hexadecimal string representing the 24 byte correlation identifier.

Publish Accounting Token (PUBACCT)

Specifies the accounting token for messages published to this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*NONE
Messages are placed on the destination with an accounting token of MQACT_NONE.
publish-accounting-token
Specify the 64 character hexadecimal string representing the 32 byte publish accounting token.

Publish Application Id (PUBAPPID)

Specifies the publish application identity for messages published to this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*NONE
No publish application identifier is specified.
publish-application-identifier
Specify the publish application identifier.

Subscription User Id (SUBUSER)

Specifies the user profile that owns this subscription.

The possible values are:

*SAME
The attribute is unchanged.
*CURRENT
The current user profile is the owner of the new subscription.
user-profile
Specify the user profile.

Subscription User Data (USERDATA)

Specifies the user data associated with the subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*NONE
No user data is specified.
user-data
Specify a maximum of 256 bytes for user data.

Note: User data of greater than 256 bytes can be specified using MQSC.

Selector String (SELECTOR)

Specifies the SQL 92 selector string to be applied to messages published on the named topic to select whether they are eligible for this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*NONE
No selection string is specified.
selection-string
Specify a maximum of 256 bytes for selection string.

Note: Selection strings of greater than 256 bytes can be specified using MQSC.

PubSub Property (PSPROP)

Specifies the manner in which publish / subscribe related message properties are added to messages sent to this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*NONE
Publish / subscribe properties are not added to the message.
*COMPAT
Publish / subscribe properties are added to the message to maintain compatibility with V6 Publish / Subscribe.
*RFH2
Publish / subscribe properties are added to the message within an RFH 2 header.
*MSGPROP
Publish / subscribe properties are added as message properties.

Destination Class (DESTCLASS)

Specifies whether this is a managed subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*MANAGED
The destination is managed.
*PROVIDED
The destination is a queue.

Subscription Scope (SUBSCOPE)

Specifies whether this subscription should be forwarded (as a proxy subscription) to other brokers, so that the subscriber will receive messages published at those other brokers.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*ALL
The subscription will be forwarded to all queue managers directly connected via a publish / subscribe collective or hierarchy.
*QMGR
The subscription will only forward messages published on the topic within this queue manager.

Variable User (VARUSER)

Specifies whether user profiles other than the creator of the subscription can connect to it (subject to topic and destination authority checks).

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*ANY
Any user profiles can connect to the subscription.
*FIXED
Only the user profile that created the subscription can connect to it.

Request Publications (REQONLY)

Specifies whether the subscriber will poll for updates via MQSUBRQ API, or whether all publications are delivered to this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*YES
Publications are only delivered to this subscription in response to an MQSUBRQ API.
*NO
All publications on the topic are delivered to this subscription.

Publish Priority (PUBPTY)

Specifies the priority of the message sent to this subscription.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*ASPUB
The priority of the message sent to this subscription is taken from that supplied in the published message.
*ASQDEF
The priority of the message sent to this subscription is taken from the default priority of the queue defined as the destination.
priority-value
Specify a priority ranging from 0 through 9.

Wildcard Schema (WSCHEMA)

Specifies the schema to be used when interpreting wildcard characters in the topic string.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*TOPIC
Wildcard characters represent portions of the topic hierarchy.
*CHAR
Wildcard characters represent portions of strings.

Expiry Time (EXPIRY)

Specifies the expiry time of the subscription. After a subscription's expiry time has elapsed, it becomes eligible to be discarded by the queue manager and will receive no further publications.

The possible values are:

*SYSDFTSUB
The value of this attribute is taken from the system default subscription.
*UNLIMITED
The subscription does not expire.
expiry-time
Specify an expiry time in tenths of a second ranging from 0 through 999999999.