@ComponentProfile(summary="A configurable exception handling instance", tag="error-handling,base") public class StandardProcessingExceptionHandler extends RootProcessingExceptionHandler implements EventHandlerAware
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.
log
Constructor and Description |
---|
StandardProcessingExceptionHandler()
Creates a new instance.
|
StandardProcessingExceptionHandler(Service... services) |
StandardProcessingExceptionHandler(ServiceList service) |
Modifier and Type | Method and 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
|
changeState, getAlwaysHandleException, getParent, getUniqueId, notifyParent, onChildError, registerDigester, registerParent, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveDigester, setAlwaysHandleException, setUniqueId
public StandardProcessingExceptionHandler()
Creates a new instance. Defaults to null implementations.
public StandardProcessingExceptionHandler(ServiceList service)
public StandardProcessingExceptionHandler(Service... services)
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.
handleProcessingException
in interface ProcessingExceptionHandler
msg
- the AdaptrisMessage
to handlepublic void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
close
in interface ComponentLifecycle
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
CoreException
protected void logErrorMessage(Service p, AdaptrisMessage m)
public Service getProcessingExceptionService()
public void setProcessingExceptionService(Service s)
s
- the servicepublic void registerWorkflow(Workflow w)
registerWorkflow
in interface ProcessingExceptionHandler
w
- the workflow to register.protected java.util.Map<java.lang.String,Workflow> registeredWorkflows()
The workflows are keyed against their unique-id.
public boolean hasConfiguredBehaviour()
ProcessingExceptionHandler
hasConfiguredBehaviour
in interface ProcessingExceptionHandler
public void registerEventHandler(EventHandler eh)
EventHandlerAware
registerEventHandler
in interface EventHandlerAware
eh
- the event handler currently in use.