In general, an exception is an event that interrupts the normal flow of the program’s instructions. Exceptions occur during the execution of a program and terminates the program.
In webMethods, failures can occur in a flow service when an invoked service throws an exception, an EXIT operation executes and signals failure, or the flow engine throws an exception because of a flow definition error. The flow language includes facilities that you can use to handle these failures.
Beginning with Integration Server and Designer version 10.3, the webMethods flow language includes specific flow steps named TRY, CATCH, and FINALLY that you can use to try a sequence of flow steps, catch and handle any failures that occur, and then perform any cleanup work.
Prior to version 10.3, the webMethods flow language did not include flow steps designed for the specific purposes of trying logic and handling any failures that occurred. Instead, some degree of failure handling could be accomplished using steps like SEQUENCE and REPEAT. By nesting and combining SEQUENCE steps with different exit conditions of failure, success, and done, a flow service could provide a limited form of try-catch behavior.
TRY Step
The TRY step contains the sequence of flow steps that you want Integration Server to attempt. The TRY step contains the logic for which you want to provide exception handling via a CATCH step and cleanup work via a FINALLY step.
CATCH Step
The CATCH step contains the sequence of steps that you want executed in the event the preceding TRY step fails. Often, the CATCH step contains recovery logic.
The CATCH step can be configured to handle all failures, specific failures, or all failures except specific failures.
FINALLY Step
The FINALLY step contains logic that Integration Server executes regardless of whether the TRY step succeeds or fails.
FINALY step contains clean up logic that needs to execute regardless of the outcome of the preceding TRY or CATCH steps, such as releasing resources or closing sockets.
Common Patterns for Failure Handling:
- TRY-CATCH
- TRY-FINALLY
- TRY-CATCH-FINALLY
No comments:
Post a Comment