Mediator is one of the components of the Oracle SOA Suite tool; it provides mediation capabilities such as selective routing, transformation, and validation capabilities. We use mediator when components needs to exchange information within a composite as it is very light mediation framework.
We can use mediator component to connect to different sources and consume a business event or receive a service invocation. You can use an Oracle Mediator service component to handle returned responses, callbacks, faults, and timeouts. Mediator component follow VETRO pattern, where we Validate, Enrich, Transform, Route and do Operations.
Features of Mediator
1. Content based and Header Based routing.
2. Synchronous and Asynchronous Interactions.
3. Sequential and Parallel Routing.
4. Message Re-sequencing.
5. Data Transformation.
6. Payload validation
7. Event Handling
It is the core features of Mediator component – the ability to route data between a source and target. The routing is implemented by adding one or more Routing Rules to a Mediator. Each Routing Rule defines how data flows from a source to a target service, may have additional properties that defined if the data needs to be validated, filtered, and transformed.
There are two types of routing rules in Mediator:
Dynamic routing rule: These rules are used for asynchronous interactions only. Business rules are used in these rules and endpoint is determined at run time from business rules.
Static routing rule: These rules are used for synchronous and asynchronous interactions and these are defined at design time.
Further routing rules are of two types:
Sequential: As name suggested, Oracle Mediator evaluates routing and performs the resulting actions sequentially .Sequential Routing Rules execute in a single thread and transaction as the caller. Oracle Mediator always enlists itself into the global transaction propagated through the thread that is processing the incoming message. In case of exceptions it rolls back all transactions.
Parallel: As names suggest, Oracle Mediator queues and evaluates routing in parallel in different threads. Oracle Mediator initiates a new transaction for processing each parallel rule. In case of exceptions it roll back transactions in their own thread.