Reading Messages in a Queue
Reading messages in a queue is a two-function operation if the application only reads the first message in the queue and is a three-function operation if the application needs to navigate through the queue. To read the first message in the queue, the application must call MQOpenQueue and MQReceiveMessage. However, to read messages that are not at the front of the queue, the application must call MQOpenQueue, MQCreateCursor, and then MQReceiveMessage.
For examples, see:
When reading messages in a queue, MSMQ can peek at the messages or retrieve them.
When reading messages, the application can retrieve all the message properties that are provided by MSMQ. It is the application's responsibility to specify which message properties it wants to read (this includes the body of the message).
Message properties include:
PROPID_M_ACKNOWLEDGE
PROPID_M_ADMIN_QUEUE
PROPID_M_ADMIN_QUEUE_LEN
PROPID_M_APPSPECIFIC
PROPID_M_ARRIVEDTIME
PROPID_M_AUTH_LEVEL
PROPID_M_AUTHENTICATED
PROPID_M_BODY
PROPID_M_BODY_SIZE
PROPID_M_BODY_TYPE
PROPID_M_CLASS
PROPID_M_CONNECTOR_TYPE
PROPID_M_CORRELATIONID
PROPID_M_DELIVERY
PROPID_M_DEST_QUEUE
PROPID_M_DEST_QUEUE_LEN
PROPID_M_DEST_SYMM_KEY
PROPID_M_DEST_SYMM_KEY_LEN
PROPID_M_ENCRYPTION_ALG
PROPID_M_EXTENSION
PROPID_M_EXTENSION_LEN
PROPID_M_HASH_ALG
PROPID_M_JOURNAL
PROPID_M_LABEL
PROPID_M_LABEL_LEN
PROPID_M_MSGID
PROPID_M_PRIORITY
PROPID_M_PRIV_LEVEL
PROPID_M_PROV_NAME
PROPID_M_PROV_NAME_LEN
PROPID_M_PROV_TYPE
PROPID_M_RESP_QUEUE
PROPID_M_RESP_QUEUE_LEN
PROPID_M_SECURITY_CONTEXT
PROPID_M_SENDER_CERT
PROPID_M_SENDER_CERT_LEN
PROPID_M_SENDERID
PROPID_M_SENDERID_LEN
PROPID_M_SENDERID_TYPE
PROPID_M_SENTTIME
PROPID_M_SIGNATURE
PROPID_M_SIGNATURE_LEN
PROPID_M_SRC_MACHINE_ID
PROPID_M_TIME_TO_BE_RECEIVED
PROPID_M_TIME_TO_REACH_QUEUE
PROPID_M_TRACE
PROPID_M_VERSION
PROPID_M_XACT_STATUS_QUEUE
PROPID_M_XACT_STATUS_QUEUE_LEN