Class AdvancedMessageSplitterService
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,EventHandlerAware
,MessageEventGenerator
,Service
,ServiceWrapper
,StateManagedComponent
- Direct Known Subclasses:
PoolingMessageSplitterService
Splits incoming AdaptrisMessage
s into several using an implementation of MessageSplitter
.
Rather than directly producing the message to a producer, this allows the use of a ServiceCollection
as
the target for the resulting split messages.
In the adapter configuration file this class is aliased as advanced-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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
executeService
(Service s, AdaptrisMessage msg) protected void
handleSplitMessage
(AdaptrisMessage msg, Consumer<Exception> callback) protected void
void
prepare()
Prepare for initialisation.void
Register the current event handler against this component.boolean
protected void
void
Whether or not to send events for the message that has been split.void
setService
(Service sc) 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.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
-
Field Details
-
eventHandler
-
-
Constructor Details
-
AdvancedMessageSplitterService
public AdvancedMessageSplitterService()Creates a new instance. Defaults to copying all metadata from the original message to the new, split messages.
-
-
Method Details
-
handleSplitMessage
protected void handleSplitMessage(AdaptrisMessage msg, Consumer<Exception> callback) throws ServiceException - Specified by:
handleSplitMessage
in classMessageSplitterServiceImp
- Throws:
ServiceException
-
executeService
- Throws:
Exception
-
sendEvents
- Throws:
CoreException
-
initService
- Overrides:
initService
in classMessageSplitterServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()- Overrides:
closeService
in classMessageSplitterServiceImp
-
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:
-
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:
-
getService
- Returns:
- the serviceList
-
setService
- Parameters:
sc
- the serviceList to set
-
getSendEvents
- Returns:
- the sendEvents
-
sendEvents
public boolean sendEvents() -
setSendEvents
Whether or not to send events for the message that has been split.Note that even if this is set to true, because each child message has its own unique id, you will have to externally correlate the message lifecycle events together. Child messages will always have the metadata
CoreConstants.PARENT_UNIQUE_ID_KEY
set with the originating message id.- Parameters:
b
- true to send events (default false)
-
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.- See Also:
-
prepare
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Specified by:
prepare
in interfaceComponentLifecycleExtension
- Throws:
CoreException
-
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.
-