Mediations
A mediation is a Java program that extends the messaging capabilities of WAS. Mediations can be used to simplify connecting systems, services, applications, or components that use messaging.
Mediations are used to process in flight messages. The type of processing a mediation can undertake includes:
- Transforming a message from one format into another.
- Route messages to one or more additional target destinations.
- Add data to a message from a data source.
- Controlling message delivery based on some conditional logic in the mediation.
We can use a mediation to process messages as an alternative to using a message-driven bean (MDB). A mediation has two advantages:
- It preserves the message identity. If an MDB re-sends a message after processing its body, it sends a new message with a new message ID and message properties. By preserving the message identity, using a mediation makes it easier to track messages.
- It is independent of the messaging technology. The mediation programming model provides a Service Data Objects (SDO) Version 1 interface to all messages and a common API for accessing properties and metadata.
When a message arrives at the mediation point, the mediation consumes the message and either transforms, subsets, aggregates or disaggregates the message. The message is then either forwarded to another destination or returned to the same destination, in which case, the message goes to the queue point where it can be consumed by the messaging application. This is shown in the following figure:
We can configure a destination so the mediation point or the queue point, or both are WebSphere MQ queues. If both are Websphere MQ queues then a WebSphereMQ application can act as an external mediation as shown in the following figure:
WebSphere Application Server provides a mediation framework runtime that enables us to mediate messages. IBM Rational Application Developer and the assembly tools provide the tools needed to develop, assemble, test and deploy mediations.
We can mediate any type of destination in the service integration bus: inbound or outbound services, queues, and topic spaces. When you mediate a destination it is split into two parts called pre-mediated and post-mediated. The mediation receives messages from the pre-mediated part. Providing the messages are not redirected to another destination or discarded by the mediation, the mediation places messages on the post-mediated part. Messages on the post-mediated part are delivered to a message consumer. Splitting a destination into two parts allows asynchronous mediation of messages.
At deployment, the administrator can choose to have the mediation operate within a global unit of work to ensure transactional integrity, or to support concurrency if throughput of messages at a destination is important.
After deployment, the administrator configures the mediation for use at runtime using the WAS console. The mediation is configured for use at a specific destination. The physical location is called a mediation point. The message processing provided by the mediation is started when the mediation point receives a message from the messaging runtime environment. The mediation operates on the message, for example transforming it, or forwarding it to other destinations.
Subtopics
- Mediation handlers and mediation handler lists
Mediations are specified as a simple sequential list of mediation handlers. We must assemble and deploy the mediation handler list into an Enterprise Applications Archive and install it in WebSphere Application Server. Once the mediation is associated with a destination, it processes messages arriving at that destination. A mediation handler is the Java class that processes the messages.
- Transactionality in mediations
We can configure a mediation handler to run within a global transaction.
- Performance tuning for mediations
We can set the property sib:SkipWellFormedCheck in the console to improve the performance of a mediation. Before you set a property to tune a mediation, you should consider the behavior of the mediation, to prevent the modification or loss of messages.
- Performance monitoring for mediations
Mediation performance monitoring is provided by the WAS Performance Monitoring Infrastructure (PMI).
- Concurrent mediations
Several messages might be mediated concurrently, to achieve maximum throughput for a selected mediated destination.
- Mediation points
A mediation point is a location in a messaging engine at which messages are stored and mediated.
- Mediation context information
Mediation context information is used to ensure that messages are processed correctly by parameterizing the mediation handlers, providing configuration information at runtime. For example, the name of a file to write to.
- Mediations security
When bus security is enabled, authorization permissions are required to ensure that mediations can run, and undertake messaging operations securely on a service integration bus. There are mechanisms for mediations security, and implications for running mediations on a bus that spans multiple security domains.
- Mediation application installation
A mediation application is an enterprise application (EAR file) containing a mediation handler enterprise bean project. Installing the EAR file into WebSphere Application Server (base) makes the mediation handler available for use at a destination.
- Mediation programming
Using the capabilities of the mediation infrastructure, we can program mediations to customize the way that a service integration bus handles messages. You develop the mediation code within a component called a mediation handler, and add the mediation handler to a handler list, which is an application that is ready to deploy and install. We can connect a number of mediation handlers together in a mediation handler list to create a set of operations to run on a message.
Related concepts
WebSphere MQ queue points and mediation points WebSphere MQ server and mediated exchange scenarios Service integration technologies Messaging engines Bus destinations Service integration security
Related tasks
Configure mediations Set tuning properties for a mediation Delete a mediation Mediating a destination Unmediating a destination Configure exception destination processing for a bus destination Create a queue-type destination and assigning it to a WebSphere MQ queue Mediating a destination by using a WebSphere MQ queue as the mediation point
createSIBDestination command createSIBDestinations command mediateSIBDestination command unmediateSIBDestination command
Related information:
A practical introduction to message mediation -- Part 1 A practical introduction to message mediation -- Part 3 A practical introduction to message mediation -- Part 4 A practical introduction to message mediation -- Part 5