158 Using IBM WebSphere Message Broker as an ESB with WebSphere Process Server
Throw node
A Throw node is used to throw an exception within a message flow. The Throw
node shown in Figure 6-44 is the last of the series of nodes that is connected to
the Catch terminal of the JMSInput node.
Figure 6-44 Throw node
When an exception occurs in the message flow anywhere along the nodes
connected to output terminal of the JMSInput node (ReceiveTransferRequest),
the exception is caught and processed by the Catch terminal of the JMSInput
node.
In this scenario, a message is sent to the two JMS providers, the CreditToBank1
and DebitFromBank2 JMSOutput nodes, downstream under XA transactional
control. Suppose that CreditToBank1 can send the message successfully, but
DebitFromBank2 fails. An exception is thrown by DebitFromBank2 indicating that
it cannot put the message. This exception is caught by the Catch terminal of the
JMSInput node, and the catch path is invoked. To prevent the first, successful
CreditToBank1 node from sending the message, a Throw node is included in the
catch path. The Throw node sends the error back to the JMSInput node, which
causes a rollback to be issued for the successful message. Hence the
transactional integrity is maintained.