Storing and using properties in the message context

Store a property in the message context so that it is available for use later in the mediation flow. First, add the property as an empty business object in the message context. Then, initialize the property by using a mediation primitive such as Message Element Setter to add a value to the business object attribute.

You can use the context section of the message to store a property that mediation primitives can use later in the flow. The data to be contained in the context must be defined in a single business object. There are two context elements that can be used for passing properties in a flow:
correlation
makes the property persist throughout the duration of the request and response flows, and is used for passing values from the request flow to the response flow.
transient
makes the property available for the duration of the current flow (either the request flow or the response flow), and is used to pass values between mediation primitives in the same flow.
In the Mediation Flow editor, both correlation and transient contexts are defined in the input node in the request flow, even though the value may not be set until the response flow. The value of a correlation context property persists through the request and response flows. The value of a transient property is only available to mediation primitives in the flow in which it was set.

Follow these steps to set a property in the correlation or transient context of your flow:

  1. If you do not have an existing business object, create one in the business object editor, and add the persistent property as an attribute.
  2. Click on the request flow tab, and then click on the input node.
  3. In the Properties view, switch to the Details tab.
  4. In the Correlation context or Transient context field, click Browse.
  5. Select a business object in the data type selection window, and click OK. An empty business object is created in the message's context section. In the properties view, the business object now appears in the input node's context field, as shown below:

    Picture of the correlation context in the input node's properties view

  6. Initialize the property later in the flow by using a mediation primitive such as Message Element Setter to store a value in the business object attribute.
You can use an XPath 1.0 expression to access the property from any mediation primitive in the flow, except Fail and Stop. For example, to access the transient property oneWayStreet, use this XPath expression:
/context/transient/oneWayStreet

You can then use the property in the following ways:

Related concepts
Mediation services overview
Mediation Flow editor
Related tasks
Creating a mediation flow
Opening the Mediation Flow editor
Building mediation flows
Emitting common base events
Creating mappings for the XSL Transformation primitive
Selecting endpoints dynamically
Implementing custom mediation logic
Changing the value of mediation flow properties at runtime
Testing and debugging mediation modules
Related reference
Error handling in the mediation flow
Considerations when refactoring mediation flow artifacts

Related information

Tutorial: Create a mediation flow
Samples: Mediation Flow editor
Contributing your own mediation primitive plug-in

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.