@ComponentProfile(summary="Split a message and execute an arbitary number of services on the split message", tag="service,splitter") public class AdvancedMessageSplitterService extends MessageSplitterServiceImp implements EventHandlerAware, ServiceWrapper
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.
MessageSplitterServiceImp.AlreadyComplete
Modifier and Type | Field and Description |
---|---|
protected EventHandler |
eventHandler |
KEY_CURRENT_SPLIT_MESSAGE_COUNT, KEY_SPLIT_MESSAGE_COUNT
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
AdvancedMessageSplitterService()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
protected void |
executeService(Service s,
AdaptrisMessage msg) |
java.lang.Boolean |
getSendEvents() |
Service |
getService() |
java.util.concurrent.Future<?> |
handleSplitMessage(AdaptrisMessage msg) |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
registerEventHandler(EventHandler eh)
Register the current event handler against this component.
|
boolean |
sendEvents() |
protected void |
sendEvents(AdaptrisMessage msg) |
void |
setSendEvents(java.lang.Boolean b)
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 component
|
Service[] |
wrappedServices()
Return all the services that are wrapped by this service.
|
doService, getIgnoreSplitMessageFailures, getSplitter, ignoreSplitMessageFailures, setIgnoreSplitMessageFailures, setSplitter, waitForCompletion
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
continueOnFailure, doService, isBranching, setUniqueId
createName, createQualifier, isTrackingEndpoint
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
getUniqueId
close, init
getLookupName
protected transient EventHandler eventHandler
public AdvancedMessageSplitterService()
Creates a new instance. Defaults to copying all metadata from the original message to the new, split messages.
public java.util.concurrent.Future<?> handleSplitMessage(AdaptrisMessage msg) throws ServiceException
handleSplitMessage
in class MessageSplitterServiceImp
ServiceException
MessageSplitterServiceImp.handleSplitMessage(com.adaptris.core.AdaptrisMessage)
protected void executeService(Service s, AdaptrisMessage msg) throws java.lang.Exception
java.lang.Exception
protected void sendEvents(AdaptrisMessage msg) throws CoreException
CoreException
protected void initService() throws CoreException
initService
in class MessageSplitterServiceImp
CoreException
protected void closeService()
closeService
in class MessageSplitterServiceImp
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
start
in class ServiceImp
CoreException
- wrapping any underlying Exception
sComponentLifecycle.start()
public void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
stop
in class ServiceImp
ComponentLifecycle.stop()
public Service getService()
public void setService(Service sc)
sc
- the serviceList to setpublic java.lang.Boolean getSendEvents()
public boolean sendEvents()
public void setSendEvents(java.lang.Boolean b)
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.
b
- true to send events (default false)public void registerEventHandler(EventHandler eh)
EventHandlerAware
registerEventHandler
in interface EventHandlerAware
eh
- the event handler currently in use.EventHandlerAware.registerEventHandler(com.adaptris.core.EventHandler)
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
CoreException
public Service[] wrappedServices()
ServiceWrapper
wrappedServices
in interface ServiceWrapper