Showing posts with label mediation. Show all posts
Showing posts with label mediation. Show all posts

Thursday, August 28, 2008

Multiple Mediator Example

SCI-Flex provides an extension that connects the Open Source CEP System, Esper with the Apache Synapse ESB. Due to various possible formats of messages being exchanged between the two components, SCI-Flex extensions for Synapse-Esper mediation comes in several flavors. As of now, we have two mediators, namely the XMLMediator, which operates on XML DOM information, and the AxiomMediator, which operates on Axiom based Tree representations of XML.

Necessarily, XML and Axiom are two different ways one could look into the same problem, but, depending on the scenario, one is always better than the other. There can also be situations where the ESB and CEP communicate with information flowing from various sources. This leads to situation which would perhaps reqire both the mediators in action rather than one.

Each SCI-Flex mediator communicates with a specific instance of Esper CEP system, and adding two mediators would necessarily add two instances of Esper unless otherwise explicitly stated. This can be challenging as there can be queries that span across data handled by both the mediators. The solution is simple. It requires us to share a single instance of the CEP engine.

How it is done is what is important. Each instance of the CEP engine needs to be configured before it being used. According to how the mediator is being implemented, each mediator has the capability of configuring the CEP engine. Thus, it is important to decide on who configures the CEP engine. We have used a standard way of configuring the CEP engine in the first mediator lying in the mediation path.

Once configured, a unique instance URI can be used to access the shared CEP instance. A more detailed example that uses two event sources, a web service and a timer, is found in here.

Friday, June 20, 2008

Message Mediation


Moving a bit interior....................

This is one of a keys to drive our project to it's successiveness and effectiveness.Hence have the underlying concept of message mediation as a prerequisite to SCI-Flex.

Message mediation is one of the new capabilities of some components like synapse. Mediation is a programmable extension to the messaging capabilities of services that can simplify connecting systems, other services, applications, or components that use messaging. Mediation is used to process in-flight (I just mean the messages on the fly) messages. The types of processing mediation can perform include:
  • 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.