In OSB we can handle Error in different level as follows
Here am going to explain the possible ways exception or error handling in osb ,For better understand comparing OSB error handling with java
1 ) Stage
2 ) Pipe Line (Request/Response)
3 ) Service
4 ) System (System Internal )
If there is no error handler is configured at the level where error has occurred then the error will be propagated to next level (if error handler is there in this level the handler will be executed) error propagation as below.
Stage Node --> Pipeline Pair-> Service->System
We can compare the OSB error handling with JAVA,if any exception is not catched in any method then calling or caller method had a chance to catch the exception and do some necessary action
Public Class CallExternalService
{
public void getADSLSpeed()
{
///////////////////////////
}
}
Public Class ADSLSpeedService
{
CallExternalService service;
public void calculateSpeed()
{
try
{
service.getADSLSpeed()
}catch(Exception e)
{
-------------------
}
///////////////////////////
}
}
As per above java code assume the that CallExternalService is stage node no error handing is done so it sends error or exception to caller Service (ADSLSpeedService) where error is handing in Service level.
In real time we will use common / default error handler mechanism for any service is not available or error while calling service from Stage or pipe line pair.
Ideally default error handler will do the following things
1) Insert the error in the DB for logging purpose
2) Trigger a mail to administrator depending on the fault.
3) Publish error in Queue with with necessary information (using this information the operational team will do manual process)
While doing error handling we need to make a note on a communication pattern i.e Synchronous or Asynchronous.
Important points while handling error
- If the error occurred in synchronous need to return minimum error information like error code,description and message id
- If the services are more alike Asynchronous then we need to have common error logging/audit framework which will receive errors
- through DB or JMS ,Based on error types we can notify or persist the error
- fault context variable is available only in error handler.
While designing fault schema object consider the below important points
- Error Code
- Error Descripition
- Error Reference (i.e Service Name and Which operation)
- Instance Id (This information you can get inbuilt function fn:uuid)
- Error Type (System Error or Business Error)
- Error Notification