IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Building mediation flows

Storing and using elements in the message context

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

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 three 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.

shared

element is available during aggregation operations using the Fan Out / Fan In combination. This context should not be used outside aggregation operations.
In the Mediation Flow editor, all 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. The shared context is provided for use in a Fan Out / Fan In aggregation. It will be empty after the execution of a Service Invoke primitive when configured for Async callback outside a Fan Out / Fan In aggregation sequence.

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


Procedure

  1. If you do not have an existing business object, create one in the business object editor, and add the element you want to persist as a field.

  2. Click the request flow tab, and then click 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:

  6. Initialize the element later in the flow by using a mediation primitive such as Message Element Setter to store a value in the business object field.


What to do next

Alternatively you can use the tray on the right side of the mediation flow editor to set the contexts.

To use this, click the + button next to the context and select the business object from the list. You can use an XPath 1.0 expression to access the element from any mediation primitive in the flow, except Fail and Stop.

For example, to access the transient element oneWayStreet, use this XPath expression:

/context/transient/oneWayStreet

You can then use the property in the following ways:

Building mediation flows