Routing Rule Sets
Click the ruleSet tab.
A Routing Rule Set contains a series of rules and/or actions. Individual rules can contain actions, but they must be embedded in when blocks. The actions inside a when block execute only if a message matches the rule's constraint and the when block's condition. A constraint specifies meta-data criteria for a message, including the HL7 schema and message structure for the HL7 data carried by the message and the source of the message (component that sent the message to the router). A condition usually specifies specific details about the message or its HL7 content.
The above Rule Set contains only a single rule. Its constraint is blank. This means that all incoming messages match the constraint. The rule contains a single when block. Its condition is set to 1, meaning always true (a condition can never be blank). All incoming messages thus match the condition as well as the constraint.
The when block contains two actions:
send — This action sends a messsage to a target (another component in the production) optionally applying a data transformation first. The transformation to apply is specified in the transform box. So, in this case, the action transforms messages using the Tutorial.DemoDTL transformation and then sends them to the TutorialFileOperation.
return — This actions quits the execution of the Rule Set.
When a router receives a message, it begins executing its Rule Set. The router executes the rules and actions in the order (top to bottom) that they are listed in the Rule Editor. Execution stops when either a return action is executed or the last rule or action in the set executes.
An individual rule can contain multiple when blocks. A sequence of when blocks behaves like an if..elseif structure. Only the actions of the first when block with a condition matching the current message execute. A series of when blocks can end with an otherwise (analogous to an else structure). The actions of the otherwise block execute if the message fails to match the conditions of any of the preceding when blocks.
For more information about Routing Rule sets, read Defining Routing Rule Sets for HL7 in the Ensemble HL7 Version 2 Development Guide.