Define MCE-Style Routing in IWS Translator

This article describes how you can build Message Center Editor-style routing inside a single IWS translator. This kind of routing allows you to route different messages to different translators based on conditions derived from incoming data fields.

The router's main function is to look at the incoming message (one of the many messages which comes in the data file) and, based on values in this message, route it to one translator or another. For example, a BUY trade may need a different treatment than a SELL. And you may need yet another mapping for CANCELs.

In this example, you create multiple translators (although they are just dummies) and you add router choices. The router choices are essentially just expressions, based on which a specific message goes to one translator or another.

Create a Simple Workflow

You can create a simple workflow with a Begin shape, Task Translator shape, and End shape. In this example, you create a solution that is not based on an existing template.

Open IWS and create a simple solution by dragging a Begin shape, a Task Translator shape, and an End shape from the toolbox onto the worksheet.

Workflow with Begin, Task Translator, and End Shapes

Provide Task Translator Details

When you drop the Task Translator shape onto worksheet, it becomes an empty "shell" of the translator, This is fine if you are just building a sketch of your future workflow, But eventually you need to provide the details, such as how the messages will be routed inside the translator, and how it will be mapped from the incoming format to the outgoing format. 

To provide those details: 

  1. Double-click the Task Translator shape, task_translator. 
    You see the Add task box.

    Add Task box
  2. In the Name box, enter the name of the translator, and then click OK.
    You see the Select parameters box, where you provide information about incoming and outgoing data formats.

    Select Parameters box
  3. In this example, it is sufficient to select Delimited File for delimited (CSV) on both the Source Format and Destination Format tabs, and click Apply. 
    (For the purpose of this example, you do not need to add other details.)
    After you click the Apply button (and click OK at the warning about deprecated classic mode), the system finally creates your translator.

    The system opens the task translator tab showing the name you selected, where you see the routing diagram with the Message Router shape, identified with a red box in the following figure. Notice that the Processing Tasks options are now available in the Toolbox pane.

    Translator tab

    The next time you double-click the Task Translator shape (the shape with gears) in the workflow worksheet, you will see this translator tab immediately. You perform the creation/initialization part of the setup just once. The content of the toolbox is different because you are now in the "second level" of design – inside the task_translator.


    There is also a "third level" of design. You can double-click the router in (Message Router shape in red box) to view this level. When you do so, you see the Router's Choice option in the Objects toolbox. The tab shows the task translator name you selected, prefaced by rt_.

    Alternately, you can double-click the translator (Message Translator shape #4 in the prior figure) to define the mapping, which is also at the third level of design. 

Define Routing Expressions and Mappings

After you create the translator, you can define routing expressions and mappings.

When you define routing expressions and mappings in third-level tabs and save them, the system does not automatically refresh the diagram shown in the second-level router_translator tab. You must refresh the router_translator tab information manually to reflect your most recent changes by clicking Apply settings from the router worksheet button on the worksheet.

To define routing expressions and mappings:

  1. Double-click the router translator shape to add and manage routing expressions.

    Router Translator Tasks


    You see the "third level" of design. The tab shows the task translator name you selected, prefaced by rt_.

  2. In the Objects toolbox, drag one or more Router's Choice elements onto the worksheet. 
    The router's choice is a shape which holds the condition (expression). Based on that condition, a specific message is routed to one translator or another. There is a Default Choice shape as well. The system uses the default choice if none of the provided conditions are met, that is, if none were evaluated to true.

  3. Populate an expression for the router and enter a value for the Description property, which is an information label visible in the router translator tab. 
    For ease of mapping, you can also add the Source grid to this worksheet, but it is not necessary.

    Set Up Router's Choice Elements
  4. Click the router_translator tab and then click  Apply settings from the router worksheet button below the router block to refresh the worksheet.
    The worksheet expands to show you the newly added router's choices.

    View Router's Choices
    View Router's Choices
  5. In the Processing Tasks toolbox, drag two Message Translator shapes and drop them to the right of each router's choice shape. Then connect the elements.
    In the following example, Translator1 and Translator2 are currently just empty shapes.

    Create Translator1 and Translator2 Shapes
  6. Double-click the Translator1 and Translator2 shapes and define the mapping for each one.
    You see the Add Translator box for the selected shape.

  7. In the Name box, enter the name for each shape and click OK. 
    You see a worksheet for the selected translator.

  8. Define the Source and Destination information for each selected translator. 
    The following figure shows how you can drag the Source and Destination objects from the toolbox onto the grid. The Source grid in the example could be populated with a sample file because you clicked the Load from File button in the Select Parameters box earlier in this article. Alternatively, after dragging the Source and Destination objects from the toolbox, you can click the Source grid's Set Source link to set the source. You can then populate the Destination grid by dragging and dropping lines from the Source grid to the Destination grid. 

    Define Translator1 and Translator2 Mappings


    By default, outbound rules group incoming data.

  9. To avoid that situation, and to have line-by-line routing instead, click the router_translator tab.

  10. On the WorkSheet tab, click Properties.
    You see the WorkSheet Properties dialog box.

  11. Clear the Enable Grouping check box in the router translator's Worksheet Properties dialog box, and close the box.


Preview the Ruleset and Rules

To validate that the routing logic was properly added to the underlying Message Center rule, you can click the Publish button and preview the ruleset and rules (translators).

On the Solution tab, click Publish.

In the Publish Solution preview screen, you can now see that the stream contains additional translators, and there are appropriate mapping expressions in the rsf file. 

Publish Solution window