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.

No comments: