Class DefaultFailedMessageRetrier
- java.lang.Object
-
- com.adaptris.core.FailedMessageRetrierImp
-
- com.adaptris.core.DefaultFailedMessageRetrier
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageListener
,ComponentLifecycle
,ComponentLifecycleExtension
,FailedMessageRetrier
@ComponentProfile(summary="A Configurable Failed Message Retrier", tag="error-handling,base") public class DefaultFailedMessageRetrier extends FailedMessageRetrierImp implements AdaptrisMessageListener
Implementation of
FailedMessageRetrier
that does not allow duplicate workflows.In the adapter configuration file this class is aliased as default-failed-message-retrier which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.FailedMessageRetrierImp
log
-
-
Constructor Summary
Constructors Constructor Description DefaultFailedMessageRetrier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the component.java.lang.String
friendlyName()
Get the friendly name for this component.TimeInterval
getShutdownWaitTime()
Set the shutdown wait timeout for the pool.@NotNull StandaloneConsumer
getStandaloneConsumer()
void
init()
Initialises the component.void
onAdaptrisMessage(AdaptrisMessage msg, java.util.function.Consumer<AdaptrisMessage> success, java.util.function.Consumer<AdaptrisMessage> failure)
Handle a message with call back actions if a message is successful or failed.void
prepare()
Prepare for initialisation.void
setShutdownWaitTime(TimeInterval shutdownWaitTime)
Set the shutdown wait timeout for the pool.void
setStandaloneConsumer(StandaloneConsumer consumer)
void
start()
Starts the component.void
stop()
Stop the component-
Methods inherited from class com.adaptris.core.FailedMessageRetrierImp
addWorkflow, clearWorkflows, getUniqueId, getWorkflow, getWorkflow, getWorkflows, registeredWorkflowIds, setUniqueId, updateRetryCountMetadata
-
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.AdaptrisMessageListener
onAdaptrisMessage, onAdaptrisMessage
-
-
-
-
Method Detail
-
onAdaptrisMessage
public void onAdaptrisMessage(AdaptrisMessage msg, java.util.function.Consumer<AdaptrisMessage> success, java.util.function.Consumer<AdaptrisMessage> failure)
Description copied from interface:AdaptrisMessageListener
Handle a message with call back actions if a message is successful or failed.- Specified by:
onAdaptrisMessage
in interfaceAdaptrisMessageListener
- Parameters:
msg
- the messagesuccess
- called on successfailure
- called on failure
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Specified by:
prepare
in interfaceComponentLifecycleExtension
- Throws:
CoreException
-
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- See Also:
ComponentLifecycle.start()
-
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
-
setStandaloneConsumer
public void setStandaloneConsumer(StandaloneConsumer consumer)
-
friendlyName
public java.lang.String friendlyName()
Description copied from interface:AdaptrisMessageListener
Get the friendly name for this component.- Specified by:
friendlyName
in interfaceAdaptrisMessageListener
- Returns:
- the friendly name.
-
getStandaloneConsumer
@NotNull public @NotNull StandaloneConsumer getStandaloneConsumer()
-
getShutdownWaitTime
public TimeInterval getShutdownWaitTime()
Set the shutdown wait timeout for the pool.When
close()
is invoked, this shutdowns the internal retry submission pool used byDefaultFailedMessageRetrierJmxMBean
. The specified value is the amount of time to wait for a clean shutdown. If this timeout is exceeded then a forced shutdown ensues, which may mean some messages will not have been retried. The default is 60 seconds if not explicitly specified.
-
setShutdownWaitTime
public void setShutdownWaitTime(TimeInterval shutdownWaitTime)
Set the shutdown wait timeout for the pool.When
close()
is invoked, this shutdowns the internal retry submission pool used byDefaultFailedMessageRetrierJmxMBean
. The specified value is the amount of time to wait for a clean shutdown. If this timeout is exceeded then a forced shutdown ensues, which may mean some messages will not have been retried. The default is 60 seconds if not explicitly specified.
-
-