WebSphere

Example: Ticket pricing system

This example shows you how the various parts of the mediation policy model interact, in a specific case.

Overview

The following example shows an SCA module, called applyDiscountPolicy, that receives messages containing the age of a ticket buyer. Mediation policies are used to retrieve the ticket discount that should be applied.

The design is to have one default mediation policy and two conditional mediation policies (the condition being the age of the ticket buyer). Mediation flows will use the conditional mediation policies when particular conditions apply, and the default mediation policy when no specific conditions apply.
Note: Mediation policies are not designed for creating complex business processes. Typically, if you require complex business processing you should consider the business process support found in WebSphere® Process Server.

To achieve this design, the integration developer creates an SCA module that has one mediation flow component and one property group. The mediation flow component contains one Policy Resolution mediation primitive, which has one dynamic (promoted) property: discount, and one condition (Policy condition name): age. The condition has an XPath of: /body/input/age (which tells the run time whereabouts in the message the condition can be found). In addition, the mediation flow component contains two other mediation primitives: one to do a database query and one to process the output from the database query.

When the SCA module is exported, WebSphere Integration Developer creates one default mediation policy (because there is only one property group).

When the WSRR administrator loads the SCA module, the SCA module is loaded together with the default mediation policy. The WSRR administrator then creates two new mediation policies, both of which contain the discount property; and attaches the default mediation policy and the two user-defined mediation policies to the SCA module. Finally, the WSRR administrator creates conditions for the user-defined mediation policies. One mediation policy can only be used for people over the age of 59, and the other mediation policy can only be used for people under the age of 12.

What happens at run time

At run time, the SCA module receives a message and queries the WSRR instance that has been loaded with the applyDiscountPolicy module, and its default mediation policy.

WSRR will return whichever mediation policy fits the message being processed. The mediation policy provides the mediation flow with the discount that should be applied: 10 percent, 5 percent or 0 percent. After the run time knows the discount, the applyDiscountPolicy module can call a database to get the normal ticket price. Lastly, the normal ticket price and the discount percentage are passed to a Custom Mediation primitive, which calculates the actual ticket price. After the applyDiscountPolicy module has completed its processing, it passes the new message (containing the actual ticket price) to the service provider.
Figure 1. At run time, the service provider receives a context-specific message
When a message is passed to the applyDisountPolicy module, it can get a discount percentage from an associated mediation policy in WSRR.

concept Concept topic

Terms of use | Feedback


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


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