Class StatelessServiceWrapper
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,EventHandlerAware
,MessageEventGenerator
,Service
,ServiceWrapper
,StateManagedComponent
Stateless service wrapper, wraps any configured service and allows you to set a strategy on when to restart the service before allowing it to execute.
Consider using this wrapper on a service where you will periodically want to stop and re-start a service. Check
RestartStrategy
for the available restarting strategies. Note that some nested configuration will be ignored,
particularly ServiceImp.setContinueOnFail(Boolean)
in the nested service. If you want that behaviour, then you should explicitly
configure it in this service.
In the adapter configuration file this class is aliased as stateless-service-wrapper 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Create a name for anyMleMarker
that is generated.Create a qualifier for anyMleMarker
that is generated.void
doService
(AdaptrisMessage msg) Apply the service to the message.protected void
boolean
Returns true if the implementation supports branching.boolean
Returns true if this should be considered an 'end-point' for tracking purposes, otherwise false.void
prepare()
Prepare for initialisation.void
Register the current event handler against this component.void
whether or not this service is is a tracking endpoint.void
setRestartStrategy
(RestartStrategy restartStrategy) void
void
start()
Starts the component.void
stop()
Stop the componentService[]
Return all the services that are wrapped by this service.Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, getContinueOnFail, getUniqueId, init, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, 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.Service
continueOnFailure, setUniqueId
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
Constructor Details
-
StatelessServiceWrapper
public StatelessServiceWrapper() -
StatelessServiceWrapper
-
-
Method Details
-
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
- Overrides:
stop
in classServiceImp
-
start
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
- Overrides:
start
in classServiceImp
- Throws:
CoreException
- wrapping any underlyingException
s- See Also:
-
createName
Description copied from interface:MessageEventGenerator
Create a name for anyMleMarker
that is generated.The default implementation is to return the classname of the component in question.
* @return the name for anyMleMarker
that is generated.- Specified by:
createName
in interfaceMessageEventGenerator
- Overrides:
createName
in classServiceImp
-
createQualifier
Description copied from interface:MessageEventGenerator
Create a qualifier for anyMleMarker
that is generated.The default implementation is to return the unique-id of the component in question, or the empty string if not configured
- Specified by:
createQualifier
in interfaceMessageEventGenerator
- Overrides:
createQualifier
in classServiceImp
- Returns:
- the qualifier for any
MleMarker
that is generated.
-
isTrackingEndpoint
public boolean isTrackingEndpoint()Description copied from interface:MessageEventGenerator
Returns true if this should be considered an 'end-point' for tracking purposes, otherwise false.
- Specified by:
isTrackingEndpoint
in interfaceMessageEventGenerator
- Overrides:
isTrackingEndpoint
in classServiceImp
- Returns:
- true if this should be considered an 'end-point' for tracking purposes, otherwise false
-
isBranching
public boolean isBranching()Description copied from interface:Service
Returns true if the implementation supports branching.
- Specified by:
isBranching
in interfaceService
- Overrides:
isBranching
in classServiceImp
- Returns:
- true if the implementation supports branching
- See Also:
-
initService
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()- Specified by:
closeService
in classServiceImp
-
prepare
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Specified by:
prepare
in interfaceComponentLifecycleExtension
- Throws:
CoreException
-
doService
Description copied from interface:Service
Apply the service to the message.
- Specified by:
doService
in interfaceService
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
getService
- Returns:
- the wrappedService
-
setService
- Parameters:
s
- the wrappedService to set
-
getIsTrackingEndpoint
- Overrides:
getIsTrackingEndpoint
in classServiceImp
-
setIsTrackingEndpoint
Description copied from class:ServiceImp
whether or not this service is is a tracking endpoint.- Overrides:
setIsTrackingEndpoint
in classServiceImp
- Parameters:
b
- true/false, default if not specified is false.
-
getRestartStrategy
-
setRestartStrategy
-
registerEventHandler
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.
-
wrappedServices
Description copied from interface:ServiceWrapper
Return all the services that are wrapped by this service.- Specified by:
wrappedServices
in interfaceServiceWrapper
- Returns:
- an array of wrapped services.
-