There are times when a target Event Port needs information that was produced by a service instance that occurred earlier in the workflow. Consider an event process representing a ten-step business process. In these ten steps, each step is implemented using a service instance. By using application context, a service instance representing the tenth step in the process can use the information generated by the service instance in the second step.
The Application Context is set as a JMS Message Property on the message and is available throughout the function, which can be used anywhere in the event process using an Xslt component or using Route Transformation.
Defining Application Context
To define Application Context for an application, perform the steps below:
- In the Event Process project, click in the Orchestration Editor and open the Properties view.
- Click the Application Context tab in the Properties view and enable the Application Context option.
- Enable Application Context checkbox and select the DTD or XSD option to choose the schema type.
XSD schema type: Click the Edit Schema button, provide the schema content in the editor that is displayed and click the Ellipsis button to select the root from the list of Root elements.
Figure 1: Application Context properties with XSD selected
DTD schema type: Click the Edit Schema button, provide the schema content in the editor that is displayed and Click OK.
Select the root from the Root attribute in the Application Context properties.
Figure 2: Application Context properties with DTD selected
This defines application context schema for the Event Process.
Provide a name in the Value property to save the Application Context instance defined.
Setting Route Transformation to map Application Context
After creating the Application Context, configure it to the desired output port from where the value needs to be propagated. To achieve this, set the Route Transformation from the output port.
To configure Route Transformation, perform the actions below:
- Right-click the desired output port, go to the Configure Application Context option and select the Mapper Project option to open the Mapper editor.
Figure 3: Opening Mapper editor
The Mapper editor opens up where the mapping for the Application Context can be defined. Connect the routes as required (from OUT_PORT element to Application-Context element) and save the mappings. The port figure will be shown in bold font to give a visual representation.
Figure 4: Mapper editor
Once the Application Context is configured at one of the output ports as shown above, the value is propagated in the message flow.