Apama 10.3.1 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Session Management | Overriding default error handling for sessions
 
Overriding default error handling for sessions
The default error handler is invoked if there is an error related to a session. For example, an error can occur when
*Connection to a session fails.
*Disconnection from a session fails.
*You try to remove a previously set callback and you specify an invalid callback Id.
The default error handler sends a message to the correlator log file at the ERROR level. To change this behavior, execute the SessionHandler.addErrorCallback() action and specify a callback function that handles errors. An error handling callback that you define can use SessionHandler.defaultErrorCallback() to invoke the default error callback.
You can execute the addErrorCallback() action multiple times on the same session handler to implement multiple error handling callbacks. If you add one or more error callbacks to a session handler then the default error callback is not executed for that session handler.
The parameters of a user-defined error callback include the session handler and also a com.apama.utils.Error event. An Error event has fields for a message, a dictionary of parameters, and an error type code. The addErrorCallback() action adds the specified callback to the set of callbacks executed if there is an error in the operation of the specified session handler.
The com.apama.session.HandlerErrorConstants event defines the following error type codes for sessions:
*CONNECTION_FAILED
*DISCONNECTION_FAILED
*UNKNOWN_CONNECTED_CALLBACK
*UNKNOWN_ERROR_CALLBACK
When you add an error callback the return value is an integer reference ID that you can specify if you execute removeErrorCallback() to discontinue execution of that error callback. To remove all error callbacks, execute the SessionHandler.clearErrorCallbacks() action. If you remove all previously set error callbacks then error handling behavior reverts to calling the default error callback.
A callback is unknown if you specify an incorrect reference ID for the connected callback or error callback you are trying to remove with the SessionHandler.removeConnectedCallback() or SessionHandler.removeErrorCallback() action.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.