Class RootProcessingExceptionHandler
- java.lang.Object
-
- com.adaptris.core.RootProcessingExceptionHandler
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ErrorHandlerRegistrar
,ProcessingExceptionHandler
,StateManagedComponent
- Direct Known Subclasses:
NullProcessingExceptionHandler
,StandardProcessingExceptionHandler
public abstract class RootProcessingExceptionHandler extends java.lang.Object implements ProcessingExceptionHandler, StateManagedComponent
RootProcessingExceptionHandler which allows you to register a Digester for aggregating information about all the errors that have occurred.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description RootProcessingExceptionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeState(ComponentState newState)
Updates the state for the componentComponentState
.java.lang.Boolean
getAlwaysHandleException()
ProcessingExceptionHandler
getParent()
java.lang.String
getUniqueId()
Get the unique-id that is associated with this component.void
notifyParent(AdaptrisMessage message)
void
onChildError(AdaptrisMessage message)
void
registerDigester(MessageErrorDigester digest)
void
registerParent(ProcessingExceptionHandler handler)
void
requestClose()
Request this component is closed.void
requestInit()
Request this component is init'd.void
requestStart()
Request this component is started.void
requestStop()
Request this component is stopped.ComponentState
retrieveComponentState()
Returns the last recordeComponentState
.protected MessageErrorDigester
retrieveDigester()
void
setAlwaysHandleException(java.lang.Boolean b)
Always handle any exceptions in this error handler.void
setUniqueId(java.lang.String uniqueId)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stop
-
Methods inherited from interface com.adaptris.core.ComponentLifecycleExtension
prepare
-
Methods inherited from interface com.adaptris.core.ProcessingExceptionHandler
handleProcessingException, hasConfiguredBehaviour, registerWorkflow
-
-
-
-
Method Detail
-
registerParent
public void registerParent(ProcessingExceptionHandler handler)
- Specified by:
registerParent
in interfaceErrorHandlerRegistrar
-
getParent
public ProcessingExceptionHandler getParent()
-
notifyParent
public void notifyParent(AdaptrisMessage message)
- Specified by:
notifyParent
in interfaceErrorHandlerRegistrar
-
onChildError
public void onChildError(AdaptrisMessage message)
- Specified by:
onChildError
in interfaceErrorHandlerRegistrar
-
requestInit
public void requestInit() throws CoreException
Description copied from interface:StateManagedComponent
Request this component is init'd.
- Specified by:
requestInit
in interfaceStateManagedComponent
- Throws:
CoreException
- wrapping any underlying Exceptions
-
requestStart
public void requestStart() throws CoreException
Description copied from interface:StateManagedComponent
Request this component is started.
- Specified by:
requestStart
in interfaceStateManagedComponent
- Throws:
CoreException
- wrapping any underlying Exceptions
-
requestStop
public void requestStop()
Description copied from interface:StateManagedComponent
Request this component is stopped.
- Specified by:
requestStop
in interfaceStateManagedComponent
-
requestClose
public void requestClose()
Description copied from interface:StateManagedComponent
Request this component is closed.
- Specified by:
requestClose
in interfaceStateManagedComponent
-
retrieveComponentState
public ComponentState retrieveComponentState()
Description copied from interface:StateManagedComponent
Returns the last recorde
ComponentState
.- Specified by:
retrieveComponentState
in interfaceStateManagedComponent
- Returns:
- the current
ComponentState
-
changeState
public void changeState(ComponentState newState)
Description copied from interface:StateManagedComponent
Updates the state for the component
ComponentState
.- Specified by:
changeState
in interfaceStateManagedComponent
-
retrieveDigester
protected MessageErrorDigester retrieveDigester()
-
registerDigester
public void registerDigester(MessageErrorDigester digest)
- Specified by:
registerDigester
in interfaceErrorHandlerRegistrar
-
getUniqueId
public java.lang.String getUniqueId()
Description copied from interface:AdaptrisComponent
Get the unique-id that is associated with this component.- Specified by:
getUniqueId
in interfaceAdaptrisComponent
- Returns:
- the unique-id
-
setUniqueId
public void setUniqueId(java.lang.String uniqueId)
-
getAlwaysHandleException
public java.lang.Boolean getAlwaysHandleException()
-
setAlwaysHandleException
public void setAlwaysHandleException(java.lang.Boolean b)
Always handle any exceptions in this error handler.This is primarily useful if you have a chain of error handling (i.e you have configured an explicit error handling at one of the workflow / channel levels); by setting this to be true, then you fire the error handling on each of the configured error handlers in turn as they propogate back to the configured adapter error handler. This means that you can have a chain of error handling behaviour like (narrowest first).
- workflow-error-handler : send a HTTP 500 response.
- adapter-error-handler : write to filesystem /opt/adaptris/bad; always-handle-exception=true
This will cause the adapter-error-handler to write the original message to
/opt/adaptris/bad
, as well as sending a 500 response back to the client.Note that setting this to be true may have some behavioural oddities if you have chained
RetryMessageErrorHandler
instances in configuration; The number of attempts that each configuredRetryMessageErrorHandler
will attempt to handle a message will vary; the total number of attempts should not exceed the highest configured max-retry-count on any individualRetryMessageErrorHandler
- Parameters:
b
- true or false, default null (false).
-
-