Gets or sets the message identifier used by acknowledgment and report messages to reference the original message.
[Visual Basic] Overridable Public Property CorrelationId As String [C#] public string CorrelationId {virtual get; virtual set;} [C++] public: __property virtual String* get_CorrelationId(); public: __property virtual void set_CorrelationId(String*); [JScript] public function get CorrelationId() : String; public function set CorrelationId(String);
The message identifier (Id) of the original message, used when Message Queuing generates an acknowledgment or report message.
Exception Type | Condition |
---|---|
InvalidOperationException | The message queue is filtered to not read the CorrelationId property. |
ArgumentException | The CorrelationId is a null reference (in Visual Basic Nothing). |
CorrelationId provides access to the CorrelationId property of the Message Queuing MSMQMessage object.
CorrelationId provides an application-defined identifier that the receiving application can use to sort messages.
When Message Queuing generates an acknowledgment or report, it uses the CorrelationId property to specify the message identifier of the message that generated the acknowledgment or report. The application can then look at the CorrelationId property to find the message Id of the original message.
When sending response messages to the sending application, CorrelationId can be set to the Id of the message that is in the queue. This provides a mechanism for the sending application to use to match the response message with the original message that triggered the response.
Message Class | Message Members | System.Messaging Namespace | Id | Acknowledgement | AcknowledgeType | UseJournalQueue | UseTracing | PeekByCorrelationId | ReceiveByCorrelationId