If an error occurs during the outbound (request) flow, the adapter invokes the Error Handler. The Error Handler performs actions, such as archiving the incoming business object, and then the adapter returns a -1 failure status to the broker.
An interface error handler is provided with the adapter. It has methods for handling errors in event as well as request processing. Use the information in this section to implement the methods.
These methods collect the error-related information from the adapter runtime (for example, whether the error occurred during "event" or "response to event", which component caused the error (data handler, message handler, or broker), what was the exact exception thrown, what was the originating event, and so on).
This feature is currently used at message handler, data handler and broker error checkpoints. ErrorLocation is a variable passed by the adapter to the method invoked during Request processing (handleRequestError).
The following are examples of checkpoints in request processing.
The following section provides information you can use to implement the interface. Note that handleRequestError is the method of Error Handler invoked in request processing.
This section also lists some predefined values provided for the input parameters. The predefined values are underlined.
package com.ibm.adapters.protocol.util; import com.crossworlds.cwconnectorapi.CWConnectorBusObj; public interface ErrorHandler { public String handleEventError( byte[] event, //data over input stream of the socket byte[] errorData, //portion of input bytes which caused error, as the input data can contain multiple messages (see SupportMultipleMessages in Service MO), out of which only some portion can be invalid. This parameter tells which exact portion contain invalid data. String errorLocation, //MessageHandler/DataHandler/Broker Object exceptionObj, //actual exception String flow //event/responseToEvent ); public String handleRequestError( CWConnectorBusObj currBusObj,//BO from broker String errorLocation, //DataHandler/MessageHandler/SendRequestToServer/ProcessResponseFromServer/ InDoVerbFor Object exceptionObj, //actual exception String flow //request/responseToRequest ); }
The return type of the method handleEventError should be the string that has to be written back to the calling TCP/IP client.