Sending Messages to a Queue

Sending messages is typically a two-function operation: a single call to MQOpenQueue to open the queue and then one or more calls to MQSendMessage. After the queue is opened, the application can send any number of messages to the queue.

For examples of sending different types of messages, see:

Note  Transaction messages can only be sent to transaction queues, and non-transaction messages can only be sent to non-transaction queues.

Message are defined by a set of properties specified in an MQMSGPROPS structure. This structure provides the number of properties that will be sent with the message, identifiers for each property, and the value of each property.

Message Properties

The following are general message properties that can be set by the application (length properties that are associated with another property are not included):

PROPID_M_ACKNOWLEDGE

PROPID_M_ADMIN_QUEUE

PROPID_M_APPSPECIFIC

PROPID_M_BODY

PROPID_M_BODY_TYPE

PROPID_M_CONNECTOR_TYPE

PROPID_M_CORRELATIONID

PROPID_M_DELIVERY

PROPID_M_EXTENSION

PROPID_M_JOURNAL

PROPID_M_LABEL

PROPID_M_PRIORITY

PROPID_M_RESP_QUEUE

PROPID_M_TIME_TO_BE_RECEIVED

PROPID_M_TIME_TO_REACH_QUEUE

PROPID_M_TRACE

PROPID_M_XACT_STATUS_QUEUE

Security Message Properties

Security message properties are used for authenticating and encrypting messages. The following security message properties can be set by the application:

PROPID_M_AUTH_LEVEL

PROPID_M_DEST_SYMM_KEY

PROPID_M_ENCRYPTION_ALG

PROPID_M_HASH_ALG

PROPID_M_PRIV_LEVEL

PROPID_M_PROV_NAME

PROPID_M_PROV_TYPE

PROPID_M_SECURITY_CONTEXT

PROPID_M_SENDER_CERT

MSMQ-Generated Messages Properties

The following message properties are set by MSMQ and should not be specified by the sending application. They are attached to the message when it is sent.

Message Property Description
PROPID_M_ARRIVEDTIME Indicates when the message arrived at its target queue.
PROPID_M_AUTHENTICATED Indicates if the message was authenticated.
PROPID_M_CLASS Indicates the type of message (such as normal, acknowledgment, or report).
PROPID_M_DEST_QUEUE Indicates the destination of the message.
PROPID_M_MSGID Indicates the message's MSMQ-generated identifier.
PROPID_M_SENDERID Indicates the identifier of the sending application.
PROPID_M_SENDERID_TYPE Indicates the type of identifier found by MSMQ.
PROPID_M_SENTTIME Indicates when the message was sent.
PROPID_M_SIGNATURE Indicates the digital signature of the message.
PROPID_M_SRC_MACHINE_ID Indicates the machine identifier of the computer from where the message was sent.
PROPID_M_VERSION Indicates what version of MSMQ the sending application is running.