Filter node
Use the Filter node to route a message according to message content.
- Developer
- Application Integration Suite
- Standard
- Advanced
This topic contains the following sections:
Purpose
Create a filter expression in ESQL to define the route that the message is to take. You can include elements of the input message or message properties in the filter expression, and you can use data that is held in an external database to complete the expression. The output terminal to which the message is routed depends on whether the expression evaluates to true, false, or unknown.
Connect the terminals that cover all situations that could result from the filter; if the node propagates the message to a terminal that is not connected, the message is discarded even if it is transactional.
The Filter node accepts ESQL statements
in the same way as the Compute and Database nodes. The last statement
that is executed must be a RETURN <expression>
statement,
whose expression evaluates to a Boolean value. This Boolean value
determines the terminal to which the message is routed. In many cases,
the routing algorithm is a simple comparison of message field values.
The comparison is described by the expression and the RETURN statement
is the only statement. If you code RETURN without an expression (RETURN;
)
or with a null expression, the node propagates the message to the
Unknown terminal.
If your message flow requires more complex routing options, use the RouteToLabel and Label nodes.
The Filter node is contained in the Routing drawer of the palette, and is represented in the IBM® Integration Toolkit by the following icon:
Using this node in a message flow
Consider a situation in which you have produced an online test with ten multiple choice questions. Each message coming in has a candidate name and address followed by a series of answers. Each answer is checked, and if it is correct, the field SCORE is incremented by one. When all the answers have been checked, the field SCORE is tested to see if it is greater than five. If it is, the Filter node propagates the message to the flow that handles successful candidate input; otherwise, the message is filtered into the rejection process, and a rejection message is created.
Terminals and properties
When you have put an instance of the Filter node into a message flow, you can configure it; see Configuring a message flow node. The properties of the node are displayed in the Properties view. All mandatory properties for which you must enter a value (those that do not have a default value defined) are marked with an asterisk.
The Filter node terminals are described in the following table.
Terminal | Description |
---|---|
In | The input terminal that accepts a message for processing by the node |
Failure | The output terminal to which the message is routed if a failure is detected during the computation |
Unknown | The output terminal to which the message is
routed if the specified filter expression evaluates to unknown or
a null value |
False | The output terminal to which the message is
routed if the specified filter expression evaluates to false |
True | The output terminal to which the message is
routed if the specified filter expression evaluates to true |
The following tables describe the node properties. The column headed M indicates whether the property is mandatory (marked with an asterisk if you must enter a value when no default value is defined); the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the BAR file to deploy it).
The Filter node Description properties are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Node name | No | No | The node type | The name of the node. |
Short Description | No | No | A brief description of the node | |
Long Description | No | No | Text that describes the purpose of the node in the message flow |
The Filter node Basic properties are described in the following table.
Property | M | C | Default | Description | mqsiapplybaroverride command property |
---|---|---|---|---|---|
Data Source | No | Yes | The ODBC data source name of the database that
contains the tables to which you refer in the ESQL that is associated
with this node (identified by the Filter
Expression property). This name identifies the appropriate
database on the system on which this message flow is to execute. The
integration node connects to this database with user ID and password
information that you have specified on the mqsicreatebroker, mqsichangebroker, or mqsisetdbparms command. On z/OS® systems, the integration node uses the integration node started task ID, or the user ID and password that are specified on the mqsisetdbparms command JCL, BIPSDBP, in the customization data set <hlq>.SBIPPROC. If the ESQL that is associated with this node includes a PASSTHRU statement or SELECT function and a database reference, you must specify a value for the Data Source property. |
dataSource | |
Transaction | Yes | No | Automatic | The transaction mode for the node. The values
are:
|
|
Filter Expression | No | No | Filter | The name of the module within the
ESQL resource (file) that contains the statements to execute against
the message that is received in the node The ESQL file, which by default
has the name <message_flow_name>.esql, contains
ESQL for every node in the message flow that requires it. Each portion
of code that is related to a specific node is known as a module. If
you want the module name to include one or more spaces, enclose it
in double quotation marks in the Filter
Expression property. Code ESQL statements to customize the behavior of the Filter node in an ESQL file that is associated with the message flow in which you have included this instance of the Filter node. If an ESQL file does not already exist for this message flow, double-click the Filter node, or right-click the node and click Open ESQL to create and open a new ESQL file in the ESQL editor view. If the file exists already, click Browse beside the Filter Expression property to display the Module Selection dialog box, which lists the available Filter node modules defined in the ESQL files that can be accessed by this message flow (ESQL files can be defined in other, dependent, projects). Select the appropriate module and click OK; if no suitable modules are available, the list is empty. If the module that you specify does not exist, that module is created for you, and the editor displays it. If the file and the module exist already, the editor highlights the correct module. If a module skeleton is created for this node in a new or existing ESQL file, it consists of the following ESQL. The default module name is shown in this example:
If you create your own ESQL module, you must create this skeleton exactly. You can update the default name, but ensure that the name that you specify matches the name of the corresponding node property Filter Expression. To customize this node, add your own ESQL
after the BEGIN statement, and before the RETURN statement. If the
expression on the RETURN statement is not TRUE or FALSE, its value
is resolved to determine the terminal to which the message is propagated.
If the expression resolves to a null value, or you code |
|
You can use all the ESQL statements including SET, WHILE, DECLARE, and IF in this module, but (unlike the Compute node) the Filter node propagates the message that it receives at its input terminal to its output terminal unchanged. Therefore, in the Filter node, like the Database node, you have only one message to which to refer. The ESQL correlation names that you use in a Filter node are different from those used for a Compute node. For more information about correlation names refer to the related links. You cannot modify any part of any message, so the assignment statement (the SET statement, not the SET clause of the INSERT statement) can assign values only to temporary variables. The scope of actions that you can take with an assignment statement is therefore limited. |
|||||
Treat warnings as errors | Yes | No | Cleared | For database warning messages to be treated
as errors, and to propagate the output message from the node to the
Failure terminal, select Treat warnings
as errors. The check box is cleared initially. When you select the check box, the node handles all positive return codes from the database as errors and generates exceptions in the same way as it does for the negative, or more serious, errors. If you do not select the check box, the node treats warnings as normal return codes and does not raise any exceptions. The most significant warning raised is not found, which can be handled safely as a normal return code in most circumstances. |
|
Throw exception on database error | Yes | No | Selected | For the integration node to generate an exception
when a database error is detected, select Throw exception on database error.
The check box is selected initially. If you clear the check box, you must include ESQL to check for any database error that might be returned after each database call that you make (you can use SQLCODE and SQLSTATE to do this). If an error has occurred, you must handle the error in the message flow to ensure the integrity of the integration node and the database; the error is ignored if you do not handle it through your own processing because you have chosen not to invoke the default error handling by the integration node. For example, you can include the ESQL THROW statement to throw an exception in this node, or you can use the Throw node to generate your own exception at a later point. |
Property | M | C | Default | Description |
---|---|---|---|---|
Events | No | No | None | Events that you have defined for the node are
displayed on this tab. By default, no monitoring events are defined
on any node in a message flow. Use Add, Edit,
and Delete to create, change or delete monitoring
events for the node; see Configuring monitoring event sources by using monitoring properties for details. You can enable and disable events that are shown here by selecting or clearing the Enabled check box. |