< Previous | Next >

Build the request flow

Build the request flow for the getQuote operation: create the mediation primitives, set their properties, and wire the flow.

In the mediation flow editor, the request 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 Input Response. 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:
Screenshot of StockQuote_MediationFlow component's request flow

To build the request flow, complete the following steps:

  1. When the mediation flow opens, you will see a tip explaining how to invoke a service. Since you have already added a callout to the target service using the Service Integration template, you can close the tip.
  2. Click the Tracing palette category to expand the group.
  3. Click the Message Logger primitive and drop it onto the request flow canvas, and rename the primitive Log.
    Screenshot of MessageLogger primitive
  4. Select a Database Lookup primitive from the Transformation folder in the palette, drop it onto the request flow canvas, and name it Lookup.
  5. Select a Message Filter primitive from the Routing folder, drop it onto the request flow canvas, and name it Filter.
  6. Select an XSL Transformation primitive from the Transformation folder, drop it onto the request flow canvas, and name it TransformToDelayed.
  7. Select another XSL Transformation primitive, drop it onto the request flow canvas, and name it TransformToRealtime.
  8. Before you proceed to wire the primitives, right click the canvas and make sure that the Automatic Layout option is on.
  9. In the request flow canvas, wire the primitives:
    • The output terminal of getQuote : StockQuoteService to the input terminal of Log
    • The output terminal of Log to the input terminal of Lookup
    • The output terminal of Lookup to the input terminal of Filter
    • The default terminal of Filter to the input terminal of TransformToDelayed
    • The match1 terminal of Filter to the input terminal of TransformToRealtime
    • The output terminal of TransformToDelayed to the input terminal of getQuote : DelayedServicePortTypePartner
    • The output terminal of TransformToRealtime to the input terminal of getQuote : RealtimeServicePortTypePartner
    The wired request flow should look like this:
    Wired request flow
  10. We will now add the business object that was created earlier to the correlation context of the input node getQuote : StockQuoteService. This will allow the property subscriptionLevel to persist in the message flow. Click getQuote : StockQuoteService input node and switch to the Details tab in the Properties view. In the Correlation context field, click Browse. Select SubscriptionInformation under matching data types, and click OK. {http://Resources}SubscriptionInformation now appears in the Correlation context .
    Correlation Context added to Input node
  11. Click Log in the request flow canvas to see the primitive's properties in the Properties view. Click the Details tab to view the properties. Use the default database to log the message. Ensure that these properties are set:
    Table 1. Message Logger properties
    Property Value
    Data source name jdbc/mediation/messageLog
    Root /
    Transaction mode Same
    Message Logger details
    Root specifies the part of the message to be logged. '/' logs the complete message while '/body' logs only the body of the message.
  12. Click Lookup in the request flow canvas, and enter these property values in the Details tab:
    Table 2. Database Lookup properties
    Property Value
    Data source name jdbc/sample/CustomerDatabase
    Table CUSTOMERTABLE
    Search column CUSTOMERID
    Search location Click Edit.... In the XPath Expression Builder, type the following XPath Expression or build it using the Simple XPath Builder:/body/getQuote/request/customerID Click OK.
    In the Step 2 table, click Add... and enter the following values:
    Table 3. Database Lookup Table properties
    Column Value
    Column SUBSCRIPTIONLEVEL
    Type {http://www.w3.org/2001/XMLSchema}string
    Target location /context/correlation/subscriptionLevel
    Leave Validate input unchecked.
    Database Lookup details
  13. Click Filter in the request flow canvas. Select the Terminal view:
    1. Click match1 in the Output terminal list. The properties of the match1 terminal appear on the right.
    2. In the Terminal name field, change the name to realtime.
  14. By default, the message is sent to the TransformToDelayed primitive. You need to set the pattern for mapping to TransformToRealtime. Select the Details tab. In the Filter table, click Add... and enter the following values:
    Table 4. Filter table properties
    Column Value
    Pattern /context/correlation/subscriptionLevel = 'premium'
    Terminal name realtime
    Message Filter details
  15. A promoted property can be changed by an administrator at runtime. The pattern property can be changed at runtime to change the quality of service. To promote the pattern property:
    1. Click the Promotable properties tab.
    2. Click the promoted check box of the realtime [Pattern] property.
    3. Click the alias Filter.filters. Type PREMIUM_SERVICE to rename the alias.
    Message Filter promoted properties view
  16. Set the properties for the XSL Transformation primitive TransformToDelayed:
    1. Select the TransformToDelayed primitive in the request flow canvas and double-click it.
    2. Click Next to see the root, input, and output message types that will be mapped. Click Finish to accept the defaults. This launches the mapping editor.
    3. On the left side, the Input object side, expand body > getQuote > request. In the Output object side, the right side, expand body. Click symbol on the left side and drag it to symbol on the right side to wire them together and create the mapping.
      Mapping Editor
    4. Save your changes and close the mapping editor. The mapping file is displayed in the Details tab of the Properties view.
      TransformToDelayed details
  17. Similarly, set the properties for the XSL Transformation primitive TransformToRealtime:
    1. Select the TransformToRealtime primitive in the request flow canvas and double-click it.
    2. The New XML Mapping wizard opens. Click Next to see the root, input, and output message types that will be mapped. Click Finish to accept the defaults, this opens the mapping editor.
    3. On the left side, expand body > getQuote > request. On the right side, expand body. Click symbol on the left side and drag it to symbol on the right side to create the mapping.
    4. Save your changes and close the mapping editor. The mapping file is displayed in the Details tab of the Properties view.
  18. Save the request flow.
    Completed Request Flow





Feedback



This information center is powered by Eclipse technology. (http://www.eclipse.org)

< Previous | Next >