Class MessageSplitterServiceImp
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.splitter.MessageSplitterServiceImp
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
- Direct Known Subclasses:
AdvancedMessageSplitterService
,BasicMessageSplitterService
public abstract class MessageSplitterServiceImp extends ServiceImp
Abstract base class for splitting messages based on some criteria.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_CURRENT_SPLIT_MESSAGE_COUNT
static java.lang.String
KEY_SPLIT_MESSAGE_COUNT
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description MessageSplitterServiceImp()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
void
doService(AdaptrisMessage msg)
Apply the service to the message.java.lang.Boolean
getIgnoreSplitMessageFailures()
MessageSplitter
getSplitter()
Returns theMessageSplitter
to use.protected abstract void
handleSplitMessage(AdaptrisMessage msg, java.util.function.Consumer<java.lang.Exception> successOrFailure)
boolean
ignoreSplitMessageFailures()
protected void
initService()
void
setIgnoreSplitMessageFailures(java.lang.Boolean b)
Whether or not to ignore errors on messages that are split.void
setSplitter(MessageSplitter ms)
Sets theMessageSplitter
to use.protected void
waitForCompletion(com.adaptris.core.services.splitter.MessageSplitterServiceImp.SplitterCallback tasks, long expected)
-
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, start, stop
-
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.ComponentLifecycleExtension
prepare
-
-
-
-
Field Detail
-
KEY_SPLIT_MESSAGE_COUNT
public static final java.lang.String KEY_SPLIT_MESSAGE_COUNT
- See Also:
- Constant Field Values
-
KEY_CURRENT_SPLIT_MESSAGE_COUNT
public static final java.lang.String KEY_CURRENT_SPLIT_MESSAGE_COUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
doService
public final void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s- See Also:
#doService(com.adaptris.core.AdaptrisMessage)
-
handleSplitMessage
protected abstract void handleSplitMessage(AdaptrisMessage msg, java.util.function.Consumer<java.lang.Exception> successOrFailure) throws ServiceException
- Throws:
ServiceException
-
waitForCompletion
protected void waitForCompletion(com.adaptris.core.services.splitter.MessageSplitterServiceImp.SplitterCallback tasks, long expected) throws ServiceException
- Throws:
ServiceException
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
setSplitter
public void setSplitter(MessageSplitter ms)
Sets the
MessageSplitter
to use.- Parameters:
ms
- theMessageSplitter
to use, may not be null
-
getSplitter
public MessageSplitter getSplitter()
Returns the
MessageSplitter
to use.- Returns:
- the
MessageSplitter
to use
-
getIgnoreSplitMessageFailures
public java.lang.Boolean getIgnoreSplitMessageFailures()
- Returns:
- the ignoreSplitMessageFailures
-
ignoreSplitMessageFailures
public boolean ignoreSplitMessageFailures()
-
setIgnoreSplitMessageFailures
public void setIgnoreSplitMessageFailures(java.lang.Boolean b)
Whether or not to ignore errors on messages that are split.- Parameters:
b
- if true, then all split messages will be processed; failures are simply logged (default false)
-
-