Message context
Message context information allows the application that retrieves a message to find out about the originator of the message. The information is held in fields in the message descriptor and the fields are divided into three logical parts
These parts are as follows:
- identity context
- These fields contain information about the user of the application that put the message on the queue.
- origin context
- These fields contain information about the application itself and when the message was put on the queue.
- user context
- These fields contain message properties that applications can use to select messages that the queue manager should deliver.
When an application puts a message on a queue, the application can ask the queue manager to generate the context information in the message. This is the default action. Alternatively, it can specify that the context fields are to contain no information. The user ID associated with an application requires no special authority to do either of these.
An application can set the identity context fields in a message, allowing the queue manager to generate the origin context, or it can set all the context fields. An application can also pass the identity context fields from a message it has retrieved to a message it is putting on a queue, or it can pass all the context fields. However, the user ID associated with an application requires authority to set or pass context information. An application specifies that it intends to set or pass context information when it opens the queue on which it is about to put messages, and its authority is checked at this time.
Here is a brief description of each of the context fields:
- Identity context
-
- UserIdentifier
- The user ID associated with the application that put the message. If the queue manager sets this field, it is set to the user ID obtained from the operating system when the application connects to the queue manager.
- AccountingToken
- Information that can be used to charge for the work done as a result of the message.
- ApplIdentityData
- If the user ID associated with an application has authority to set the identity context fields, or to set all the context fields, the application can set this field to any value related to identity. If the queue manager sets this field, it is set to blank.
- Origin context
-
- PutApplType
- The type of the application that put the message; a CICS transaction, for example.
- PutApplName
- The name of the application that put the message.
- PutDate
- The date when the message was put.
- PutTime
- The time when the message was put.
- ApplOriginData
- If the user ID associated with an application has authority to set all the context fields, the application can set this field to any value related to origin. If the queue manager sets this field, it is set to blank.
- User context
-
The following values are supported for MQINQMP or MQSETMP:
- MQPD_USER _CONTEXT
-
The property is associated with the user context.
No special authorization is required to be able to set a property associated with the user context using the MQSETMP call.
On a V7.0 or subsequent queue manager, a property associated with the user context is saved as described for MQOO_SAVE_ALL_CONTEXT. An MQPUT with MQOO_PASS_ALL_CONTEXT specified causes the property to be copied from the saved context into the new message.
- MQPD_NO_CONTEXT
-
The property is not associated with a message context.
An unrecognized value is rejected with MQRC_PD_ERROR. The initial value of this field is MQPD_NO_CONTEXT.
For a detailed description of each of the context fields, see MQMD - Message descriptor. For more information about how to use message context, see Message context.
Parent topic: Authorization for applications to use IBM MQ