Class StandardProcessingExceptionHandler
- java.lang.Object
-
- com.adaptris.core.RootProcessingExceptionHandler
-
- com.adaptris.core.StandardProcessingExceptionHandler
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ErrorHandlerRegistrar
,EventHandlerAware
,ProcessingExceptionHandler
,StateManagedComponent
- Direct Known Subclasses:
RetryMessageErrorHandlerImp
@ComponentProfile(summary="A configurable exception handling instance", tag="error-handling,base") public class StandardProcessingExceptionHandler extends RootProcessingExceptionHandler implements EventHandlerAware
ProcessingExceptionHandler implementation that contains a single service to apply when a message fails.- See Also:
Service
,ServiceList
In the adapter configuration file this class is aliased as standard-processing-exception-handler which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.RootProcessingExceptionHandler
log
-
-
Constructor Summary
Constructors Constructor Description StandardProcessingExceptionHandler()
Creates a new instance.StandardProcessingExceptionHandler(Service... services)
StandardProcessingExceptionHandler(ServiceList service)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the component.Service
getProcessingExceptionService()
Get the service(s) that will be applied.void
handleProcessingException(AdaptrisMessage msg)
Handles error messages from Workflows by sending them to the configured error producer.boolean
hasConfiguredBehaviour()
Simply report back to the owning component whether or not this ProcessingExceptionHandler is actually going to do anything.void
init()
Initialises the component.protected void
logErrorMessage(Service p, AdaptrisMessage m)
void
prepare()
Prepare for initialisation.protected java.util.Map<java.lang.String,Workflow>
registeredWorkflows()
Get the map of registered workflows.void
registerEventHandler(EventHandler eh)
Register the current event handler against this component.void
registerWorkflow(Workflow w)
Register a workflow against this error handler.void
setProcessingExceptionService(Service s)
Set the service(s) that will be applied.void
start()
Starts the component.void
stop()
Stop the component-
Methods inherited from class com.adaptris.core.RootProcessingExceptionHandler
changeState, getAlwaysHandleException, getParent, getUniqueId, notifyParent, onChildError, registerDigester, registerParent, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveDigester, setAlwaysHandleException, setUniqueId
-
-
-
-
Constructor Detail
-
StandardProcessingExceptionHandler
public StandardProcessingExceptionHandler()
Creates a new instance. Defaults to null implementations.
-
StandardProcessingExceptionHandler
public StandardProcessingExceptionHandler(ServiceList service)
-
StandardProcessingExceptionHandler
public StandardProcessingExceptionHandler(Service... services)
-
-
Method Detail
-
handleProcessingException
public void handleProcessingException(AdaptrisMessage msg)
Handles error messages from Workflows by sending them to the configured error producer. The best practice would be for the service to write the message to the filesystem, which is pretty unlikely to fail.
- Specified by:
handleProcessingException
in interfaceProcessingExceptionHandler
- Parameters:
msg
- theAdaptrisMessage
to handle
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Throws:
CoreException
- wrapping any underlyingException
s
-
start
public void start() throws CoreException
Description copied from interface:ComponentLifecycle
Starts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.- Specified by:
start
in interfaceComponentLifecycle
- Throws:
CoreException
- wrapping any underlyingException
s
-
stop
public void stop()
Description copied from interface:ComponentLifecycle
Stop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing aRuntimeException
may cause unintended consequences- Specified by:
stop
in interfaceComponentLifecycle
-
close
public void close()
Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences- Specified by:
close
in interfaceComponentLifecycle
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Specified by:
prepare
in interfaceComponentLifecycleExtension
- Throws:
CoreException
-
logErrorMessage
protected void logErrorMessage(Service p, AdaptrisMessage m)
-
getProcessingExceptionService
public Service getProcessingExceptionService()
Get the service(s) that will be applied.- Returns:
- the service
-
setProcessingExceptionService
public void setProcessingExceptionService(Service s)
Set the service(s) that will be applied.- Parameters:
s
- the service
-
registerWorkflow
public void registerWorkflow(Workflow w)
Register a workflow against this error handler.- Specified by:
registerWorkflow
in interfaceProcessingExceptionHandler
- Parameters:
w
- the workflow to register.
-
registeredWorkflows
protected java.util.Map<java.lang.String,Workflow> registeredWorkflows()
Get the map of registered workflows.The workflows are keyed against their unique-id.
- Returns:
- the internal map of registered workflows.
-
hasConfiguredBehaviour
public boolean hasConfiguredBehaviour()
Description copied from interface:ProcessingExceptionHandler
Simply report back to the owning component whether or not this ProcessingExceptionHandler is actually going to do anything.- Specified by:
hasConfiguredBehaviour
in interfaceProcessingExceptionHandler
- Returns:
- true if there is actual concrete behaviour to this implementation.
-
registerEventHandler
public void registerEventHandler(EventHandler eh)
Description copied from interface:EventHandlerAware
Register the current event handler against this component.- Specified by:
registerEventHandler
in interfaceEventHandlerAware
- Parameters:
eh
- the event handler currently in use.
-
-