Package com.adaptris.core
Class RetryOnceStandaloneProducer
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.StandaloneProducer
-
- com.adaptris.core.RetryOnceStandaloneProducer
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageSender
,ComponentLifecycle
,ComponentLifecycleExtension
,ConnectedService
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Produce a message where as part of a service chain; retrying once on failure", tag="service") public class RetryOnceStandaloneProducer extends StandaloneProducer
An implementation of StandaloneProducer that on encountering an error producing a message, waits for a configurable period, re-initialises the underlying components, then tries to produce once one more.As some internal components have relationships that are persistent across their normal lifecycle, this class additionally marshals each connection and producer implementation to XML and back again prior to initialisation.
In the adapter configuration file this class is aliased as retry-once-standalone-producer which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description RetryOnceStandaloneProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doService(AdaptrisMessage msg)
Apply the service to the message.TimeInterval
getWaitBeforeRetry()
void
produce(AdaptrisMessage msg)
Produces theAdaptrisMessage
to the default destination.void
setWaitBeforeRetry(TimeInterval waitBeforeRetry)
Sets the period to wait before trying to produce again.-
Methods inherited from class com.adaptris.core.StandaloneProducer
closeService, createName, createQualifier, getConnection, getProducer, initService, prepare, setConnection, setProducer, start, stop
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
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.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:Service
Apply the service to the message.
- Specified by:
doService
in interfaceService
- Overrides:
doService
in classStandaloneProducer
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s- See Also:
Service.doService(com.adaptris.core.AdaptrisMessage)
-
produce
public void produce(AdaptrisMessage msg) throws ProduceException
Description copied from interface:AdaptrisMessageSender
Produces theAdaptrisMessage
to the default destination.- Specified by:
produce
in interfaceAdaptrisMessageSender
- Overrides:
produce
in classStandaloneProducer
- Parameters:
msg
- the @link AdaptrisMessage} to produce- Throws:
ProduceException
- wrapping any underlying Exceptions
-
getWaitBeforeRetry
public TimeInterval getWaitBeforeRetry()
-
setWaitBeforeRetry
public void setWaitBeforeRetry(TimeInterval waitBeforeRetry)
Sets the period to wait before trying to produce again.- Parameters:
waitBeforeRetry
- the period to wait before trying to produce again, if not specified defaults to 30 seconds.
-
-