@ComponentProfile(summary="Split a message and execute an arbitary number of services on the split message", tag="service,splitter", since="3.7.1") public class PoolingMessageSplitterService extends AdvancedMessageSplitterService
AdvancedMessageSplitterService
that uses a underlying thread and object pool to execute the service on each
split message.
Note that using this splitter may mean that messages become un-ordered; if the order of the split messages is critical, then you
probably shouldn't use this service. Additionally, individual split-message failures will only be reported on after all the split
messages have been processed, so unlike AdvancedMessageSplitterService
; MessageSplitterServiceImp.setIgnoreSplitMessageFailures(Boolean)
will not halt the processing of the subsequent split messages
In the adapter configuration file this class is aliased as pooling-message-splitter-service which is the preferred alternative to the fully qualified classname when building your configuration.
eventHandler
KEY_CURRENT_SPLIT_MESSAGE_COUNT, KEY_SPLIT_MESSAGE_COUNT
log
Constructor and Description |
---|
PoolingMessageSplitterService() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
java.lang.Integer |
getMaxThreads()
Set the max number of threads to operate on split messages
|
java.lang.Boolean |
getWaitWhileBusy()
Actively check if the underlying object pool is ready to accept more workers.
|
java.lang.Boolean |
getWarmStart()
Specify if the underlying object pool should be warmed up on
start() . |
protected void |
handleSplitMessage(AdaptrisMessage msg,
java.util.function.Consumer<java.lang.Exception> callback) |
protected void |
initService() |
void |
setMaxThreads(java.lang.Integer maxThreads)
Set the max number of threads to operate on split messages
|
void |
setWaitWhileBusy(java.lang.Boolean waitWhileBusy)
Actively check if the underlying object pool is ready to accept more workers.
|
void |
setWarmStart(java.lang.Boolean warmStart)
Specify if the underlying object pool should be warmed up on
start() . |
void |
start()
Starts the component.
|
protected void |
waitQuietly(java.lang.Object monitor) |
PoolingMessageSplitterService |
withMaxThreads(java.lang.Integer i) |
PoolingMessageSplitterService |
withWaitWhileBusy(java.lang.Boolean b) |
PoolingMessageSplitterService |
withWarmStart(java.lang.Boolean b) |
executeService, getSendEvents, getService, prepare, registerEventHandler, sendEvents, sendEvents, setSendEvents, setService, stop, wrappedServices
doService, getIgnoreSplitMessageFailures, getSplitter, ignoreSplitMessageFailures, setIgnoreSplitMessageFailures, setSplitter, waitForCompletion
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, 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
protected void handleSplitMessage(AdaptrisMessage msg, java.util.function.Consumer<java.lang.Exception> callback) throws ServiceException
handleSplitMessage
in class AdvancedMessageSplitterService
ServiceException
protected void initService() throws CoreException
initService
in class AdvancedMessageSplitterService
CoreException
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 AdvancedMessageSplitterService
CoreException
- wrapping any underlying Exception
sComponentLifecycle.start()
protected void closeService()
closeService
in class AdvancedMessageSplitterService
public PoolingMessageSplitterService withWarmStart(java.lang.Boolean b)
public PoolingMessageSplitterService withMaxThreads(java.lang.Integer i)
public PoolingMessageSplitterService withWaitWhileBusy(java.lang.Boolean b)
protected void waitQuietly(java.lang.Object monitor)
public java.lang.Integer getMaxThreads()
The default is 10 if not explicitly specified
public void setMaxThreads(java.lang.Integer maxThreads)
The default is 10 if not explicitly specified
public java.lang.Boolean getWarmStart()
start()
.
The default is false if not specified
public void setWarmStart(java.lang.Boolean warmStart)
start()
.
The default is false if not specified
public java.lang.Boolean getWaitWhileBusy()
If set to true, then we check that the underlying object pool has enough space for us to submit more jobs. This means that if you have a large number of split messages, then we don't attempt to flood the queue with thousands of messages causing possible issues within constrained environments. It defaults to false if not explicitly specified, and if set to true will have a small negative impact on performance.
public void setWaitWhileBusy(java.lang.Boolean waitWhileBusy)
If set to true, then we check that the underlying object pool has enough space for us to submit more jobs. This means that if you have a large number of split messages, then we don't attempt to flood the queue with thousands of messages causing possible issues within constrained environments. It defaults to false if not explicitly specified, and if set to true will have a small negative impact on performance.