- Modifying or transforming a message.
- Routing messages (or cloned messages) to other or additional destinations.
- Allowing or disallowing a message to be delivered based on some conditional logic in the mediation.
Why use mediations?
There are a number of considerations when deciding if mediations are the right solution for your task. It is already possible to write a message-driven bean (MDB) to transform messages between different formats, so why choose mediation?
The most obvious reason for using mediations is that they preserve message identities. If your MDB resends the message after you had manipulated its body, you are actually sending a new message. As a result, the message ID of the new message would be different than that of the original message. This would cause problems if you tried to correlate sent and received messages. Other message properties, such as the expiry or message timestamp will be reset or overwritten when the new message is sent.
Another reason for choosing a mediation over a message-driven bean is that mediations are not tied to a specific messaging technology
However, the mediation programming model provides a Service Data Object (SDO) interface to all messages and a common API for accessing properties and metadata.
Below I have attached a figure for further understanding of how mediation would take place. Here the mediation handler is invoked and passed message context when a incoming message needs mediation
In summary, mediation should be used when you need to transparently modify or route messages. And since the same mediation can operate on Web services or JMS messages, there are more opportunities for reuse.
No comments:
Post a Comment