TryCatch node

Use the TryCatch node to provide a special handler for exception processing.

The TryCatch node is available in the following operation modes:
  • Developer
  • Application Integration Suite
  • Standard
  • Advanced
  • Express
  • Scale
For more information, see Operation modes.

This topic contains the following sections:

Purpose

Initially, the input message is routed on the Try terminal, which you must connect to the remaining non-error processing nodes of the message flow. If a downstream node (which can be a Throw node) throws an exception, the TryCatch node catches it and routes the original message to its Catch terminal. Connect the Catch terminal to further nodes to provide error processing for the message after an exception. If the Catch terminal is connected, the message is propagated to it. If the Catch terminal is not connected, the message is discarded.

The TryCatch node is contained in the Construction drawer of the palette, and is represented in the IBM® Integration Toolkit by the following icon:

TryCatch node icon

Using this node in a message flow

Use the Throw and TryCatch nodes when you use the Compute node to calculate a total. You can create a message that is sent to your system administrator when the total that is calculated exceeds the maximum value for the Total field.

Connecting the terminals

The TryCatch node has no configurable properties that affect its operation. You determine how it operates by connecting the output terminals to subsequent nodes in your message flow.

  1. Connect the Try terminal to the first node in the sequence of nodes that provides the normal (non-error) phase of processing of this message. This sequence can contain one or more nodes that perform any valid processing. The sequence of nodes can optionally conclude with an output node.
  2. Connect the Catch terminal to the first node in the sequence of nodes that provides the error processing for this message flow. This sequence can contain one or more nodes that perform any valid processing. The sequence of nodes can optionally conclude with an output node.

    When an exception is thrown in the message flow, either by the explicit use of the Throw node or the ESQL THROW statement, or by the integration node raising an implicit exception when it detects an error that the message flow is not programmed to handle, control returns to the TryCatch node.

    The node propagates the message to the sequence of nodes connected to the Catch terminal (the catch flow) and the error handling that you have designed is initiated. The content of the message tree that is propagated is identical to the content that was propagated to the Try terminal, which is the content of the tree when the TryCatch node first received it. The node enhances the message tree with the new exception information that it has written to the exception list tree. Any modifications or additions that the nodes in try flow made to the message tree are not present in the message tree that is propagated to the catch flow.

Terminals and properties

When you have put an instance of the TryCatch 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.

The TryCatch node terminals are described in the following table.

Terminal Description
In The input terminal that accepts a message for processing by the node.
Catch The output terminal to which the message is propagated if an exception is thrown downstream and caught by this node.
Try The output terminal to which the message is propagated if it is not caught.

The following table describes 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 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 TryCatch node Description properties are described in the following table.

Property M C Default Description
Node name No No The node type: TryCatch 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 Monitoring properties of the node are described in the following table.
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.