A client can use the JMSCorrelationID header field to link one message with another. A typical use is to link a response message with its request message.
JMSCorrelationID can hold one of the following:
- A provider-specific message ID
- An application-specific String
- A provider-native byte[] value
Since each message sent by a JMS provider is assigned a message ID value, it is convenient to link messages via message ID. All message ID values must start with the 'ID:' prefix.
In some cases, an application (made up of several clients) needs to use an application-specific value for linking messages. For instance, an application may use JMSCorrelationID to hold a value referencing some external information. Application-specified values must not start with the 'ID:' prefix; this is reserved for provider-generated message ID values.
If a provider supports the native concept of correlation ID, a JMS client may need to assign specific JMSCorrelationID values to match those expected by clients that do not use the JMS API. A byte[] value is used for this purpose. JMS providers without native correlation ID values are not required to support byte[] values. The use of a byte[] value for JMSCorrelationID is non-portable.
Gets the correlation ID for the message.
This method is used to return correlation ID values that are either provider-specific message IDs or application-specific String values.
Assembly: Kaazing.JMS (in Kaazing.JMS.dll)
Syntax
| Visual Basic |
|---|
Property JMSCorrelationID As String Get Set |
| C# |
|---|
string JMSCorrelationID { get; set; } |
| Visual C++ |
|---|
property String^ JMSCorrelationID { String^ get (); void set (String^ value); } |
Return Value
the correlation ID of a message as a String
Exceptions
| Exception | Condition |
|---|---|
| Kaazing.JMS..::..JMSException | if the JMS provider fails to set the correlation ID due to some internal error. |
| Kaazing.JMS..::..JMSException | if the JMS provider fails to get the correlation ID due to some internal error. |