Add mediation function to handler code
A mediation handler is a wrapper for the mediation code that operates on the message. We can add mediation function to an existing mediation handler by working with the message context, the message properties, the message header or the message payload.
Create or open a mediation handler in an EJB project. For more information, see Writing a mediation handler.
There are four main aspects of the message through which we can change the behavior of the mediation handler code, or influence the routing of a message. We can change the values in the message context and message properties, and we can work with the contents of the message (called the message payload), or with the message header:
- Work with the message context
- Work with message properties
- Work with the message header
- Work with the message payload
Subtopics
- Example: Using mediations to trace, monitor and log messages
The most straightforward use of a mediation is for tracing, monitoring or logging messages that pass through a destination or topics spaces. This type of mediation does not modify the message; it only extracts information from the message and saves or displays the information elsewhere.- Work with the message context
We can work with the message properties to affect the way a message is mediated.- Work with message properties
We can work with the message properties to affect subsequent processing.- Work with the message header
We can add function to a preexisting mediation handler to operate on the message header.- Work with the message payload
We can work with the message payload in a pre-existing mediation handler, and transcode the message payload from one message format to another.