Skip to content

content router

Nathan Richardson edited this page Jan 9, 2019 · 14 revisions
Content Router

Icon

metl content router 48x48 color

Use When

Content within a message needs to be routed to different downstream components in the existing flow

Samples

Partition By Gender

Description

The content router routes content within a message to one or more downstream components based on the routing criteria configured in the component.

Inbound Message Type

Any Message Type

Output Message Type

Any Message Type

Control Message Handling

Input: With all messages received by this component including control messages the routing criteria is checked and if it validates then the message will be forwarded to the target including control messages.

Output: A control message will be forwarded only to target components where a message was routed based on the routing criteria unless the 'Send Control Message To All Nodes' property is checked (see below).

Properties
Name Description

Input Model

Error Suspense Step

Whether to forward failed messages and continue processing. This is the name of a linked component to forward the failed messages to.

Enabled

Rows Per Message

Send Control Messages To All Nodes

Whether a control message is forwarded to all nodes regardless of the results from the routing criteria.

Only Route First Match

If checked, the content router will only route an inbound content to the first criteria in the criteria list that evaluates to true, not all criteria in the list that evaluate to true.

Log Input

Log Output

Inbound Queue Capacity

Routing Criteria
Expression

A groovy script expression that returns true or false. The groovy script is executed/evaluated for each record in an inbound message. If the expression evaluates to true, the message is passed to the step at the right. If the expression is evaluates to false, the message is NOT passed to the step at the right.

Target Step

The target step is the connected downstream component that will receive the message if the groovy expression evaluates to true.

Tip
The inbound message will go to ALL target steps where the expression evaluates to true (i.e. a message can go to more than one target step) unless the "Only Route First Match" option is checked.
Example 1. Sample groovy expressions for an entity based message
if (ENTITY.ATTRIBUTE=='Value 1') return true;
if (ENTITY.ATTRIBUTE=='Value 2') return true;
Tip
If an entity based message has multiple entities within a single record, the record will be treated as a whole, not as its individual entities within the record. This means that the entire record (including all of its entities) will be delivered to a downstream component if the groovy expression evaluates to true, and NONE Of the entities will be delivered to the downstream component if the expression evaluates to false. For example, if the Person model contains entities NAME and ADDRESS, and the groovy expression is something like "NAME.FIRST_NAME='TOM'", a record with NAME.FIRST_NAME='TOM' will send both the NAME and ADDRESS entities to the downstream component. A record with NAME.FIRST_NAME='BOB' will send NEITHER the NAME nor ADDRESS entities of the record to the downstream component.
Example 2. Sample groovy expressions for a text based message
if (text.indexOf("Some text string") > 0) return true;
if (text.indexOf("Some other text string") > 0) return true;
Example 3. Sample groovy expressions for routing based on a message header. This example tests to see if the header variable is available before testing it
binding.variables.containsKey('chainId') && chainId.equals('001')
Example 4. Sample groovy expressions for routing based on the change type of an entity message - whether the entity message is passed to downstream components as in Add, Change or Delete ('ADD', 'CHG', or 'DEL')
CHANGE_TYPE == 'DEL'
Example 5. Sample groovy expressions for whether a specific entity exists in a given message
ENTITY_NAMES.contains("my_entity_name")
Tip
Note that the expression can explicitly return true or false or can simply evaluate to true or false as shown in the examples above.
Clone this wiki locally