次の方法で共有


MSMQMessage.CorrelationId (Compact 2013)

3/26/2014

This property identifies the message using a 20-byte, correlation identifier.

Syntax

HRESULT get_CorrelationId( 
  VARIANT* pvarMsdId 
);
HRESULT put_CorrelationId( 
  VARIANT varMsgId 
);

Parameters

  • pvarMsdId or varMsgId
    A 20-byte application-defined correlation identifier.

Return Value

The following table describes the common return values.

Value

Description

S_OK

Success

E_INVALIDARG

One or more arguments are invalid

E_NOTIMPL

The function contains no implementation

E_OUTOFMEMORY

Out of memory

Remarks

CorrelationId provides an application-defined identifier that the receiving application can use to sort messages.

The correlation identifier must be a 20-byte identifier. If the correlation identifier is not 20bytes, an MQ_ERROR_ILLEGAL_PROPERTY_SIZE error is returned when the message is sent.

When sending response messages back to the sending application, the CorrelationId property of the response message can be set to the message identifier (MSMQMessage.Id) of the original message that is in the queue. This provides an easy mechanism that the sending application can use to match the response message with the original message that was sent.

When Message Queuing generates an acknowledgment message or report message, it uses the CorrelationId property to return the message identifier of the original message. The application reading the acknowledgment or report message can then look at the CorrelationId property to find the message identifier of the original message that was sent.

When generating acknowledgment and report messages, connector applications must set the correlation identifier of the acknowledgment and report messages to the message identifier of the original message.

Equivalent Function property

When using functions, the correlation identifier of the message can be set and retrieved using the PROPID_M_CORRELATIONID property.

Requirements

Header

mqoai.h

Library

mqoa.lib

See Also

Reference

MSMQMessage
MSMQMessage.Id
PROPID_M_CORRELATIONID