Throw node

This topic contains the following sections:

Purpose

Use the Throw node to throw an exception within a message flow. The exception can be caught and processed by:

  • A preceding TryCatch node
  • The message flow input node (the built-in nodes HTTPInput, MQInput, and SCADAInput all have catch terminals)
  • A preceding AggregateReply node

You can include a Throw node to force an error path through the message flow if the content of the message contains unexpected data. For example, to back out a message that does not contain a particular field, you can check (using a Filter node) that the field exists. If it does not, the message can be passed to a Throw node that records details about the exception in the ExceptionList subtree within the message.

The Throw node is represented in the workbench by the following icon:

Throw node icon

Using this node in a message flow

Look at the following samples to see how to use this node:

Include a Throw node with a TryCatch node in your message flow to alert the systems administrator of a potential error situation. For example, if you have a Compute node that calculates a number, you can test the result of this calculation and Throw an exception if the result exceeds a certain amount. The TryCatch node catches this exception and propagates the message to a sequence of nodes that process the error.

Configuring the Throw node

When you have put an instance of the Throw node into a message flow, you can configure it. Right-click the node in the editor view and select Properties. The node's basic properties are displayed.

All mandatory properties for which you must enter a value (those that do not have a default value defined) are marked with an asterisk on the properties dialog.

Configure the Throw node as follows:

  1. In Message Catalog, enter the fully-qualified path and file name of the message catalog that contains the message source. This can be your own message catalog, or the default message catalog supplied with WebSphere Message Broker. To use the default supplied catalog, leave this property blank.
  2. In Message Number, enter the error number of the exception being thrown.

    If you have created your own message catalog, enter the number for the message in the catalog that you want to use when this exception is thrown.

    If you are using the default message catalog, specify a number between 3001 and 3049. These numbers are reserved in the WebSphere Message Broker catalog for your use. The text of each of these messages in the default message catalog is identical, but you can use a different number within this range for each situation in which you throw an exception; use the number to identify the exact cause of the error.

    The default message number is 3001.

  3. In Message Text, enter any additional free format text that contains information that you want to include with the message when it is written to the local error log. For example, if you have checked for the existence of a particular field in a message and thrown an exception when that field is not found, you might include the text:
    The message did not contain the required field: Branch number
    If you are using the default message catalog, this text is inserted as &1 in the message text.
  4. Select Description in the properties dialog navigator to enter a short description, a long description, or both.
  5. Click Apply to make the changes to the Throw node without closing the properties dialog. Click OK to apply the changes and close the properties dialog.

    Click Cancel to close the dialog and discard all the changes that you have made to the properties.

Terminals and properties

The Throw node terminal is described in the following table.

Terminal Description
In The input terminal that accepts a message for processing by the node.

The following tables describe the node properties; the column headed M indicates whether the property is mandatory (marked with an asterisk on the properties dialog 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 Throw node Basic properties are described in the following table.

Property M C Default Description
Message Catalog No No   The name of the message catalog from which the error text for the error number of the exception is extracted. The default value (blank) indicates that the message is taken from the message catalog supplied with WebSphere Message Broker.
Message Number No No 3001 The error number of the exception being thrown.
Message Text No No   Additional text that explains the cause of the error.

The Throw node Description properties are described in the following table.

Property M C Default Description
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.