You can assemble a mediation module in a number of different ways; you can begin by using the interfaces of existing services, and then create the implementation. Or you can begin with an implemented mediation flow, and end with an assembled mediation module.
Mediation services allow quick integration of existing services, and operate independently of the services they are connected to. A popular approach to building a mediation service is to discover existing services, and connect to their interfaces by adding imports and exports in a mediation module and wiring them to a mediation flow component. The mediation flow is then implemented. Later, you can easily add actions to the mediation flow, or change service providers
Or, you may have an existing mediation service, and want to add function to it, or change service providers. In this case, you would make changes to an existing mediation module or an implementation, or both.
Another approach is to begin with an implemented mediation flow component that knows the interfaces of their service requester (source) and service provider (target). Now, you want to assemble the services to resolve the references and handle the calls from one service to the other.
To illustrate the concepts covered in this topic, we will use an example of a simple mediation service that provides stock quotes. A client application provides a query containing a stock symbol and customer ID to the mediation service, which processes the query. The customer's subscription level is determined, and depending on the level of subscription, the query is routed to the appropriate service provider.
We are using a mediation service because we want to use different interfaces from two external service providers, and expose a single interface to the client application. We also need to build the service quickly, with the ability to change on demand, and without going through a top-down modeling of a business process.
Later, we will modify the mediation service by adding logic to convert the returned quote to the currency that is preferred by the customer.
The following picture shows the complete mediation service:
To build the mediation service, we begin by using the first approach that we described; discovering the service provider interfaces, and assembling the components in a mediation module. Finally, we implement the mediation flow.
To add the currency conversion function, we changed the existing StockQuote mediation module and mediation flow implementation.
The topics that follow describe both approaches. Detailed step-by-step instructions on how to use tools are available from the related information at the end of this topic.
We will change the mediation module and flow that we built earlier by adding logic to determine the customer's preferred currency. The code to execute the logic will be implemented using a Java component in the mediation module that will be called by the flow in the mediation flow component. There will be no change to the export, imports or their interfaces.
Related information