Package com.adaptris.core.services
Class SizeBasedBranchingService
java.lang.Object
com.adaptris.core.ServiceImp
com.adaptris.core.BranchingServiceImp
com.adaptris.core.services.SizeBasedBranchingService
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Perform a branch based on the size of the message",
tag="service,branching",
branchSelector=true)
public class SizeBasedBranchingService
extends BranchingServiceImp
Branching Service
which sets the unique ID of the next Service
to apply based on the size of the
AdaptrisMessage
.
If the size of the message is exactly equal to the specified criteria then the smaller service id is selected.
In the adapter configuration file this class is aliased as size-based-branching-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
Field Summary
Fields inherited from class com.adaptris.core.ServiceImp
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
doService
(AdaptrisMessage msg) Apply the service to the message.long
protected void
void
prepare()
Prepare for initialisation.void
setGreaterThanServiceId
(String serviceId) void
setSizeCriteriaBytes
(long l) void
setSmallerThanServiceId
(String serviceId) Methods inherited from class com.adaptris.core.BranchingServiceImp
isBranching
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
Constructor Details
-
SizeBasedBranchingService
public SizeBasedBranchingService()Creates a new instance.size-criteria-bytes = 1024 * 1024 * 10 (10Mb)
-
-
Method Details
-
initService
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()- Specified by:
closeService
in classServiceImp
-
doService
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
getGreaterThanServiceId
- Returns:
- the greaterThanServiceId
-
setGreaterThanServiceId
- Parameters:
serviceId
- the greaterThanServiceId to set
-
getSmallerThanServiceId
- Returns:
- the smallerThanServiceId
-
setSmallerThanServiceId
- Parameters:
serviceId
- the smallerThanServiceId to set
-
getSizeCriteriaBytes
public long getSizeCriteriaBytes()- Returns:
- the sizeCriteriaBytes
-
setSizeCriteriaBytes
public void setSizeCriteriaBytes(long l) - Parameters:
l
- the sizeCriteriaBytes to set
-
prepare
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-