Class BasicMessageSplitterService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.splitter.MessageSplitterServiceImp
-
- com.adaptris.core.services.splitter.BasicMessageSplitterService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ConnectedService
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Split a message and produce each split message somewhere", tag="service,splitter") public class BasicMessageSplitterService extends MessageSplitterServiceImp implements ConnectedService
Splits incoming
AdaptrisMessage
s into severalAdaptrisMessage
s using an implementation ofMessageSplitter
.This implementation simply uses the configured producer and connection to produce the split message.
In the adapter configuration file this class is aliased as basic-message-splitter-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.services.splitter.MessageSplitterServiceImp
KEY_CURRENT_SPLIT_MESSAGE_COUNT, KEY_SPLIT_MESSAGE_COUNT
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description BasicMessageSplitterService()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
AdaptrisConnection
getConnection()
Returns theAdaptrisConnection
to use for producing split messages.AdaptrisMessageProducer
getProducer()
Returns theAdaptrisMessageProducer
to use for producing split messages.protected void
handleSplitMessage(AdaptrisMessage msg, java.util.function.Consumer<java.lang.Exception> callback)
protected void
initService()
void
prepare()
Prepare for initialisation.void
setConnection(AdaptrisConnection conn)
Sets theAdaptrisConnection
to use for producing split messages.void
setProducer(AdaptrisMessageProducer prod)
Sets theAdaptrisMessageProducer
to use for producing split messages.void
start()
Starts the component.void
stop()
Stop the component-
Methods inherited from class com.adaptris.core.services.splitter.MessageSplitterServiceImp
doService, getIgnoreSplitMessageFailures, getSplitter, ignoreSplitMessageFailures, setIgnoreSplitMessageFailures, setSplitter, waitForCompletion
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, 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
createName, createQualifier, isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, doService, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Method Detail
-
handleSplitMessage
protected void handleSplitMessage(AdaptrisMessage msg, java.util.function.Consumer<java.lang.Exception> callback) throws ServiceException
- Specified by:
handleSplitMessage
in classMessageSplitterServiceImp
- Throws:
ServiceException
-
initService
protected void initService() throws CoreException
- Overrides:
initService
in classMessageSplitterServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Overrides:
closeService
in classMessageSplitterServiceImp
-
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
- Overrides:
start
in classServiceImp
- 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
- Overrides:
stop
in classServiceImp
- See Also:
ComponentLifecycle.stop()
-
setConnection
public void setConnection(AdaptrisConnection conn)
Sets the
AdaptrisConnection
to use for producing split messages.- Specified by:
setConnection
in interfaceConnectedService
- Parameters:
conn
- theAdaptrisConnection
to use for producing split messages, may not be null
-
getConnection
public AdaptrisConnection getConnection()
Returns the
AdaptrisConnection
to use for producing split messages.- Specified by:
getConnection
in interfaceConnectedService
- Returns:
- the
AdaptrisConnection
to use for producing split messages
-
setProducer
public void setProducer(AdaptrisMessageProducer prod)
Sets the
AdaptrisMessageProducer
to use for producing split messages.- Parameters:
prod
- theAdaptrisMessageProducer
to use for producing split messages, may not be null
-
getProducer
public AdaptrisMessageProducer getProducer()
Returns the
AdaptrisMessageProducer
to use for producing split messages.- Returns:
- the
AdaptrisMessageProducer
to use for producing split messages
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Specified by:
prepare
in interfaceComponentLifecycleExtension
- Throws:
CoreException
-
-