Wednesday, July 31, 2013

OSB-Error handling with Resume action to execute the process continously without throw the exception



In some scenarios, we want the process continuously executes the further steps and ignore the error. In Java code, it is pretty easy and what you need to do just uses a try..catch and then properly set the variables and not throw the exception again. In OSB, it has a little bit difference and a Resume action must be introduced to make the process resumed and executed continuously to handle the further steps.


Error Handler Actions
http://docs.oracle.com/cd/E13171_01/alsb/docs21/consolehelp/proxyerrors.html#1113851
When an error handler processes an error, it can finish with one of two actions:
Table 18-1 Error Handler Actions
Error Actions
Description
Reply
If you assign this action, an error response is immediately created for the proxy service client. All further Message Flow processing stops and a response message is sent based on the message-related context variables. In this instance, you can configure the error handler to send a simple reply to the proxy service or a more detailed reply stating that an error occurred.
The difference between HTTP reply with success and reply with failure is as follows:
  • Reply with success sends status code 200 and $body
  • Reply with failure status sends status code 500 and $body
Resume
When this action is included in a message flow, message flow processing continues as though no error has occurred. Processing continues after the node or stage in which the error handler is configured. You may need to configure the error handler with compensating logic to set the context variables and message state to correspond with the variable and message state expected by subsequent message flow logic. Configure the compensating logic prior to the Resume action.
If neither the Reply nor the Resume action is initiated, the error is rethrown. In this case, the error is pushed forward and handled by the next level error handler. Unless otherwise specified, the rethrow action is the default action of an error handler.