public abstract class FailedMessageRetrierImp extends java.lang.Object implements FailedMessageRetrier
Component which consumes AdaptrisMessage
s and, based on message metadata, resubmits them to the
Workflow
which processed them originally.
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
FailedMessageRetrierImp()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addWorkflow(Workflow workflow)
Add a
Workflow . |
void |
clearWorkflows()
Clear the internal store of workflows.
|
void |
close()
Closes the component.
|
java.lang.String |
friendlyName()
Get the friendly name for this component.
|
StandaloneConsumer |
getStandaloneConsumer()
Returns the
StandaloneConsumer to use. |
java.lang.String |
getUniqueId()
Get the unique-id that is associated with this component.
|
protected Workflow |
getWorkflow(AdaptrisMessage msg) |
protected java.util.Map<java.lang.String,Workflow> |
getWorkflows() |
void |
init()
Initialises the component.
|
void |
onAdaptrisMessage(AdaptrisMessage msg)
This method is
synchronized in case client code is multi-threaded. |
void |
prepare()
Prepare for initialisation.
|
java.util.Collection<java.lang.String> |
registeredWorkflowIds()
Return the list of workflow-ids registered.
|
void |
setStandaloneConsumer(StandaloneConsumer consumer)
Sets the
StandaloneConsumer to use. |
void |
setUniqueId(java.lang.String uniqueId) |
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
protected void |
updateRetryCountMetadata(AdaptrisMessage msg) |
public FailedMessageRetrierImp()
Creates a new instance. Defaults to new empty StandaloneConsumer
, which will do nothing.
public void onAdaptrisMessage(AdaptrisMessage msg)
This method is synchronized
in case client code is multi-threaded.
onAdaptrisMessage
in interface AdaptrisMessageListener
msg
- the AdaptrisMessage
to process#onAdaptrisMessage(com.adaptris.core.AdaptrisMessage)
protected Workflow getWorkflow(AdaptrisMessage msg) throws CoreException
CoreException
protected void updateRetryCountMetadata(AdaptrisMessage msg)
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
sComponentLifecycle.init()
public 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
sComponentLifecycle.start()
public 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
ComponentLifecycle.stop()
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
ComponentLifecycle.close()
public abstract void addWorkflow(Workflow workflow) throws CoreException
Workflow
.
Add a Workflow
to the internal store. If the generated key is not unique a CoreException
can be
thrown.
addWorkflow
in interface FailedMessageRetrier
workflow
- the workflow to addCoreException
- if it is considered a duplicatepublic void clearWorkflows()
FailedMessageRetrier
clearWorkflows
in interface FailedMessageRetrier
public java.util.Collection<java.lang.String> registeredWorkflowIds()
FailedMessageRetrier
registeredWorkflowIds
in interface FailedMessageRetrier
public StandaloneConsumer getStandaloneConsumer()
Returns the StandaloneConsumer
to use.
StandaloneConsumer
to usepublic void setStandaloneConsumer(StandaloneConsumer consumer)
Sets the StandaloneConsumer
to use. May not be null. Sets this
as the consumer's
AdaptrisMessageListener
.
consumer
- the StandaloneConsumer
to useprotected java.util.Map<java.lang.String,Workflow> getWorkflows()
public java.lang.String getUniqueId()
AdaptrisComponent
getUniqueId
in interface AdaptrisComponent
public void setUniqueId(java.lang.String uniqueId)
uniqueId
- the uniqueId to setpublic void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
CoreException
public java.lang.String friendlyName()
AdaptrisMessageListener
friendlyName
in interface AdaptrisMessageListener