WebSphere

Controlling message flows using mediation policies

You can control message flows using mediation policies, and associated conditions.

Before you begin

Read the mediation policies scenario which provides an overview of mediation policies, and explains how the integration developer, the runtime administrator, and the WSRR administrator must work together.

About this task

If your goal is to use context information to control the behavior of service requests, you can achieve this by using mediation policies stored in WebSphere® Service Registry and Repository (WSRR).

You can use mediation policies on either the request flow or the response flow, or both. Mediation policy information obtained on the request flow can be propagated to the response flow.

To help the explanation of mediation policies an example application is referred to. The example application is a ticket discount system in which the discount applied depends on the mediation policy used. The request flow extracts discount policies, based on the age of the traveller, and the service provider supplies the cost of a standard ticket for the journey. The response flow calculates the overall cost to the traveler, based on the discount supplied by the mediation policy.
Figure 1. Actor (service requester) and system (ESB)
Mediation policies can be used to control the behavior of service requests.
To control the results of a mediation flow by using mediation policies, complete the following steps.
Note: these steps provide an overview, they do not include all instructions for creating a complete mediation module or a WSRR registry. You should refer to the product documentation for these instructions.
Procedure
  1. Optional: If necessary, the WSRR administrator creates and configures a WSRR registry. Click this link to go to the topic for WebSphere Service Registry and Repository.
  2. The integration developer creates, configures, and exports a mediation module by completing the following steps.
    1. Create a mediation module. Click this link to go to the topic for WebSphere Integration Developer.
    2. Complete the export and import configuration, generate an implementation, and connect a source operation to a target operation. Click this link to go to the topic for WebSphere Integration Developer.
    3. On the request flow, add a Policy Resolution mediation primitive. When an SCA module contains a Policy Resolution mediation primitive, WebSphere Integration Developer generates default mediation policies when you export the module as an EAR file. Click this link to go to the topic for WebSphere Integration Developer.
    4. On the request flow, add any other mediation primitives you need, and wire the elements of the request flow together. Click this link to go to the topic for WebSphere Integration Developer.
    5. Optional: On the request flow, configure the Policy Resolution mediation primitive so that it can make use of a gate condition on a mediation policy. Create a Policy condition name, and provide the XPath: the location from which the run time gets the mediation policy condition. For example, if the XPath is set to /body/priceChecker/request/Age and the associated Policy condition name is Age, the run time sets the value of Age to whatever it finds at /body/priceChecker/request/Age. Click this link to go to the topic for WebSphere Integration Developer.
    6. On the request flow, configure the Policy Resolution mediation primitive so that the mediation policy information you get on the request flow, is available to the response flow. Select the Propagate mediation policy to response flow check box.
    7. On the response flow, add the mediation primitives whose dynamic properties you want to override with mediation policy information; wire the elements of the response flow together. Because a promoted property is also a dynamic property, its value can be overridden using mediation policies. Click this link to go to the topic for WebSphere Integration Developer.
    8. On the response flow, create and promote the mediation primitive properties that you want to override. For example, on the Custom Mediation primitive you could create a new user property called Discount.Click this link to go to the topic for WebSphere Integration Developer.
    9. On the response flow, complete the mediation primitive configuration. For example, on the Custom Mediation primitive you could add Java™ code to apply the discount provided by the mediation policy, to the ticket price returned by the service provider. Click this link to go to the topic for WebSphere Integration Developer.
    10. Export the mediation module. From WebSphere Integration Developer export the mediation module as an EAR file. Click this link to go to the topic for WebSphere Integration Developer.
  3. The administrator creates a WSRR definition, and deploys and administers the mediation module by completing the following steps.
    1. Optional: If necessary, create and configure a registry definition. Use the runtime administrative console to configure a WSRR definition. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.
    2. Deploy the mediation module. Use the runtime administrative console to install the EAR file as a new application. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.
  4. The WSRR administrator loads the SCA module (mediation module) into WSRR, and attaches mediation policies to the SCA module. (When an SCA module is loaded, any default mediation policies are automatically loaded.)
    1. Load the SCA module into WSRR. You select the EAR file containing the SCA module that you want to load. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.
    2. Optional: Create your own mediation policies. For example, you might create two mediation policies, one for people over 59 years old, and one for people under 12 years old. Both mediation policies could specify an assertion for the dynamic property Discount, because they both want to override the value of Discount. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.
    3. Attach the mediation policies that you want to use, to the SCA module. Mediation policies must be attached to SCA modules before they can be used by the run time, and before you can create gate conditions for them. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.
    4. Optional: Create gate conditions for your own mediation policies. For example, one mediation policy could have a gate condition that specified Age > 59, and another mediation policy could have a gate condition that specified Age < 12. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.
  5. The administrator enables the application.
    1. Start the application associated with the mediation module. Use the runtime administrative console to start the application associated with the SCA module. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.
    2. Optional: Access any registry changes. If the WSRR administrator updates the mediation policies and you want to have access to the changes immediately, you should clear the cache associated with the WSRR definition. Click this link to go to the topic for WebSphere ESB. Click this link to go to the topic for WebSphere ESB for z/OS. Click this link to go to the topic for WebSphere Process Server. Click this link to go to the topic for WebSphere Process Server for z/OS.

Results

When a service request invokes your mediation module , the service request causes the registry to be queried. If suitable mediation policy information (dynamic property values) is returned, it is kept for the response flow. The service is then invoked and it sends a response. During the processing of the response flow, the mediation policy information is used to override the response values. Therefore, the response that the service requester receives depends on the context of the message.

Example

Figure 2. Controlling the behavior of service requests using mediation policies
The Policy Resolution mediation primitive on the request flow overrides a Custom Mediation primitive property on the response flow.

task Task topic

Terms of use | Feedback


Timestamp icon Last updated: 20 June 2010 00:38:47 BST (DRAFT)


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wbpm.scenarios.esb1.620.doc/tasks/tscn_medpolicyusecase1.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).
iDoc on