Example: mediation policy conditions

This example shows you how the Policy Resolution mediation primitive and the registry files interact.

Introduction

In order to implement the correct mediation policy at run time, you need to understand how the properties specified by the Policy Resolution mediation primitive interact with the values of a particular message and the objects in the registry.

Policy Resolution conditions

You can specify mediation policy conditions in the Policy Resolution mediation primitive. You specify where the mediation policy condition values are found in the message, by providing XPath expressions.

Suppose that you specify the following conditions:
Table 1. Example Policy Resolution properties
Mediation policy condition name XPath
InsuranceType /body/input/insuranceType
Continents /body/input/continents
Days /body/input/numberOfDays

Registry conditions

In the registry, you can load objects such as SCA modules and mediation policy documents. When a mediation policy document specifies the objects to which it applies (in this case an SCA module) WSRR creates a policy attachment document. After a policy attachment document has been created you can add user properties to it, and the runtime environment interprets some of the user properties as necessary conditions. Only user properties that begin with the string medGate_ are used as conditions.

The following diagram shows an SCA module with three associated mediation policies. Each mediation policy has a mediation policy attachment that specifies conditions.
Figure 1. Example registry conditions
An SCA module with a number of mediation policy attachments and associated mediation policies.

Runtime conditions

At run time, suppose the message contained the following values:
Table 2. Example message values
Policy condition name XPath Value in message
InsuranceType /body/input/insuranceType Gold
Continents /body/input/continents Europe
Days /body/input/numberOfDays 28
The message values are compared to the mediation policy conditions specified in the registry. If all the conditions of a mediation policy are met, the mediation policy can be used. The following table shows which registry policies can be used with the example message.
Table 3. Suitable policies for the example message
Mediation policy name Mediation policy condition Mediation policy condition met by the example message? All mediation policy conditions met by message?
P1 Continents = Asia No No
Days > 14 Yes
P2 Continents = Europe Yes Yes
Days > 14 Yes
P3 InsuranceType = Gold Yes Yes
In this example, mediation policies P2 and P3 are applied to the associated module.
Note: Even if mediation policy conditions have been met, the properties defined in a mediation policy might not be used. The mediation policy processing model determines what information is taken from mediation policy documents, and applied to message flows.