Message context

The MessageContext API enables a classifier or transformation to obtain information about inbound messages that is not available in the message content. You can use the MessageContext to inspect the context in which inbound messages are delivered.

Classifier expressions and transformations read by default the XML content of inbound messages. When you add MessageContext to your inbound binding, the message classifier can then use the functions that are defined by the MessageContext interface to classify messages based on message attributes instead of the message content. For example, the function context:getJMSType() returns the JMSType property of a JMS message. For more information about the functions available, see MessageContext.

The following diagram illustrates how MessageContext works.

The diagram shows an incoming message with the following example attributes: JMSType, Header, Protocol. The message points to the binding and to the MessageContext. The binding either uses the get methods of MessageContext to retrieve attribute values of the message, or it uses the get methods of MessageContextProvider to access MessageContext.

Use a get method of MessageContext to retrieve the context attribute values of a message. MessageContext can also be used in a classification to filter messages based on the context attributes. To use the inbound message attributes in a transformation, set the context to MessageContextProvider and add a get method of MessageContextProvider to retrieve the message attributes in your .xsl file.