Mediation Flow How to
Websphere Integration Developer v612
Table of Contents
How to Implement error handling within a mediation
How to setup the Filter mediation primitive
How to set up Correlation Context
Related links | |
Browse Correlation context
In the Mediation Flow Editor (mediation flow section), do the following:
In the Correlation context field, click Browse.
| |
Select Data Type
| |
Correlation context set
The correration context (i.e SubscriptionInformation) is set. |
How to develop mediation flows using mediation primitives and Service Message Objects
Related links | Mediation flows Properties of nodes and mediation primitives Adding mediation primitives to the flow Building mediation flows
|
Introduction | We will use the Stock Quote sample (available in IBM Websphere Integration Developer 6.1.2 runtime) to demonstrate how to develop mediation flows using mediation primitives and Service Message Objects. |
Overview
We will assume that the Stock Quote sample is at the current stage as shown in the opposite diagram except that the mediation flow component (i.e StockQuote_MediationFlow) is not yet implemented.
We will implement a mediation flow component (i.e StockQuote_MediationFlow) by following the steps below:
|
How to generate a Mediation Flow component implementation
Related links | Mediation flows Adding mediation primitives to the flow |
Overview
Generating a mediation flow component is the first step in developing a mediation flow (i.e StockQuote_MediationFlow). | |
Generate Implementation
In the Assembly Diagram, right-click on the mediation flow component (i.e StockQuote_MediationFlow) that you want to implement and select Generate Implementation. | |
Select Folder
Select the folder (i.e StockQuote) where the Mediation Flow implementation will be generated.
Click OK. The Mediation Flow Editor opens (see below). | |
Mediation flow Editor
The Mediation Flow Editor opens up. These are the 3 sections of the Mediation Flow editor:
In the Operation connections section, the following are setup:
In the Mediation flow section, the following are setup:
| |
Next Step | Connect source operations to target operations |
How to Connect Source Operation to Target Operations
Related links | Mediation flows Adding mediation primitives to the flow |
Overview | draft.... When you connect source and target operations, a request flow and a response flow are created for each source operation that is connected. Select the source operation to view the request flow. The flow is represented from left to right. You will see an input node on the left. This is where the request message enters the flow. On the right are two callout nodes, one for each target operation. You will also see an ImmediateResponse node. This node is used when a message is to be returned to the client after the flow is executed. We will not use this node in our sample. You will add mediation primitives between the input and callout nodes and wire the flow. The completed request flow is shown below: |
Unconnected Source and Target operations
The second step in developing a mediation flow implementation is to connect the source operation/s (i.e StockQuoteServicegetQuote) to the target operation/s (DelayedServicePortTypePartnergetQuote). | |
Connect Source Operation to Target operation
Select a source operation (i.e StockQuoteServicegetQuote) and connect it to a target operation (i.e DelayedServicePortTypePartnergetQuote).
| 1 - Hover the mouse over a source operation to display the connection handle 3 - Drop the connection handle into a target operation |
Connected Source and Target operation (Request)
After connecting the source operation to the target operation, notice that a Callout node (getQuote: DelayedService) is created.
Callout node An end point in the request flow, derived from the target operations. It sends the processed message to the target operation. There is one callout node for each target operation. | |
Connected Source and Target operation (Response)
Input Response The input response node is an end point in the request and response flows. It returns the processed message as a response to the source operation.
Callout Node A callout response node is a starting point for the response flow. It forwards the message received from the target operation into the response flow. | |
How to develop the request mediation flow
Related links | Adding mediation primitives to the flow Mediation flows | ||||||||||||||||||||||||
Introduction | We will use the Stock Quote sample (available in Websphere Integration Developer 6.1.2 runtime) to demonstrate how to develop mediation flows using meadiation primitives and Service Message Objects. | ||||||||||||||||||||||||
Overview
The request flow is executed from left to right, in the following order:
| Before
After | ||||||||||||||||||||||||
The Mediation Primitives
| Transformation
| ||||||||||||||||||||||||
Add mediation primitives
|
| ||||||||||||||||||||||||
Medition flow primitives Added
The following mediation flow primitives were added:
Note:
There are errors!! | |||||||||||||||||||||||||
Medition flow primitives connected
The following mediation flow primitives were connected:
Note:
There are still errors!! | |||||||||||||||||||||||||
Next steps |
How to develop the response mediation flow
Related links | Adding mediation primitives to the flow Mediation flows | ||||||||||||||||||||||||
Introduction | We will use the Stock Quote sample (available in Websphere Integration Developer 6.1.2 runtime) to demonstrate how to develop mediation flows using meadiation primitives and Service Message Objects. | ||||||||||||||||||||||||
Overview
The diagram on the right shows the response flow that defines the mediation logic applied to the returning message as it flows through the StockQuote_MediationFlow component from the target service provider to the client.
| Before
After | ||||||||||||||||||||||||
The Mediation Primitives
| Transformation
| ||||||||||||||||||||||||
Add mediation primitives
|
| ||||||||||||||||||||||||
Medition flow primitives Added
The following mediation flow primitives were added:
Note:
There are errors!! | | ||||||||||||||||||||||||
Medition flow primitives connected
The following mediation flow primitives were connected:
Note:
There are still errors!! | |||||||||||||||||||||||||
Next steps |
How to add a mediation primitive
Related links | Mediation flows Adding mediation primitives to the flow |
Select a mediation flow primitive from the Palette
In the mediation flow editor (mediation flow section), do the following:
| |
Drop the mediation flow primitive
Move and click the mouse where you want to drop the mediation flow primitive.
| |
Rename the mediation flow primitive
You can rename the mediation flow primitive as required (i.e Log). | |
How to connect mediation flow primitives
Related links | Mediation flows Adding mediation primitives to the flow | ||||||
Making primitive connections
In the mediation flow editor (mediation flow section), do the following:
|
| ||||||
Primitives connected |
How to Setup a Database Lookup Mediation Primitive
Related links | |||||||||||
Setup Database Lookup properties
The Database Lookup primitive is not properly set up as shown by the errors below (right column).
In the Mediation Flow Editor (mediation flow section), setup the following properties to fix the errors:
In the Details section, enter the following property values:
| Errors
| ||||||||||
Derive Key path
Click on the Edit... button (right of the Key path entry field) to display the XPath Expression Builder.
In the XPath Expression Builder, do the following:
|
| ||||||||||
Add Data Elements
After setting the properties and key path, add data elements as required.
In the Data elements table, click Add... and continue below.
| |||||||||||
Add/Edit Properties
When you click the Add button above, the Add/Edit properties window shows up.
In the Add/Edit properties window, enter the following values:
| |||||||||||
Derive Message Element
Click on the Edit... button (right of the Message element entry field) to display the XPath Expression Builder.
In the XPath Expression Builder, do the following:
| |||||||||||
Database Lookup setup is complete
The database lookup setup is complete. Thus, the errors are gone. |
In the Assembly Diagram, right-click on the Java component that you want to implement and select Generate Implementation. | |
Select the package where the Java implementation will be generated.
You can select the default package or New Package.
Click OK. | |
If you selected New Package, enter Package name and click OK. | |
A new package is created (ccambil.java).
Select the package (ccambil.java) and click OK. | |
This is the generated Java source code.
Notice that you have to implement the public DataObject getTimeOfDay(DataObject input1) method. | package ccambil.java; import commonj.sdo.DataObject; public class CCambil_JavaComponent1Impl { /** /** } |
How to add a Custom Mediation Primitive
The completed etc. | |
| |
In the module assembly diagram, right-click on the CustomMediationFlow component and choose Generate Implementation. | |
Click OK. | |
An initial mediation flow implementation is generated and the Mediation Flow Editor is automatically opened.
In the Operation Connections section, the source and the target operations are shown.
In the Mediation Flow section, the input and input response nodes are shown.
Input Node: Request - getQuote : StockQuoteService The input node is the starting point for the request flow. It sends the message from the source operation into the request flow.
Input Response Node: Immediate Response The input response node is an end point in the request and response flows. It returns the processed message as a response to the source operation.
| |
In the Operation connections section, wire StockQuoteService interface's getQuote operation to StockQuoteServicePartner interface's getQuote operation. | |
After wiring the source to the target operation, a callout node appears.
Callout Node: Invoke - getQuote : StockQuoteServicePartner A callout node is an end point in the request flow. It sends the processed message to the target operation. | |
Add the PreferenceInformation business object to the correlation context of Request - getQuote : StockQuoteService. This will allow the property isPreferred to persist in the message flow.
| |
Select PreferenceInformation under matching data types, and double click. | |
{http://CustomMediation} PreferenceInformation now appears in the Correlation Context field. | |
This mediation primitive allows the use of an existing SCA component operation within the mediation flow. | |
| |
In the Define Custom Mediation panel, leave the default selection to Create a new interface with implementation.
Click Next. | |
The Specify Message Types panel shows the input message type and output message type that will be used to create the new interface. Notice that the PreferenceInformation business object set in the correlation context is also shown in the Defined Contexts section.
| |
In the Create a new interface panel, change the Name field to NewCustomInterface.
Click Next. | |
In the Define Custom Mediation panel, leave the default selection to Generate a default Java implementation class and define it using the embedded visual snippet editor.
Click Finish. | |
Notice that a new reference NewCustomInterfacePartner has been created in the operation connections section | |
To add the Java code, do the following:
// Get the symbol from the body of the message // If symbol is on the user's preferred list, set the isPreferred flag in the correlation context to 'true' // Create the preferenceInformation business object and set the isPreferred flag to true // Set the business object in the correlation context }
| |
Synchronize interfaces and references and merge the java implementation in the assembly editor to create and wire the java component associated with the custom mediation.
| |
A Merge Implementation dialog is launched to show that the NewCustomInterfacePartner reference will be added using the interface NewCustomInterface. In addition, a corresponding Java™ component will be created.
Click OK. | |
Layout the contents by right-clicking inside the Assembly Diagram and selecting Layout Contents from the context menu. | |
| |
Related links | |
1-Open the Assembly Diagram
Double-click the assembly diagram icon in the Business Integration view to open the Assembly Diagram.
Notice that a mediation flow component (Mediation1) is automatically created. You can rename this component as required.
Note: You can only have one mediation flow component in a mediation module. In other words, a mediation module can only have one mediation flow component.
| |
2-Add additional Components/Node
In addition to one Mediation Flow component, you can also add the following components (Nodes) in the Assembly Diagram (see Figure at right).
Right-click inside the Assembly Diagram and select Add Node > ???.
| |
No comments:
Post a Comment