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 nextService
to apply based on the size of theAdaptrisMessage
.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
Constructors Constructor Description SizeBasedBranchingService()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
void
doService(AdaptrisMessage msg)
Apply the service to the message.java.lang.String
getGreaterThanServiceId()
long
getSizeCriteriaBytes()
java.lang.String
getSmallerThanServiceId()
protected void
initService()
void
prepare()
Prepare for initialisation.void
setGreaterThanServiceId(java.lang.String serviceId)
void
setSizeCriteriaBytes(long l)
void
setSmallerThanServiceId(java.lang.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
-
-
-
-
Method Detail
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
doService
public 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
-
getGreaterThanServiceId
public java.lang.String getGreaterThanServiceId()
- Returns:
- the greaterThanServiceId
-
setGreaterThanServiceId
public void setGreaterThanServiceId(java.lang.String serviceId)
- Parameters:
serviceId
- the greaterThanServiceId to set
-
getSmallerThanServiceId
public java.lang.String getSmallerThanServiceId()
- Returns:
- the smallerThanServiceId
-
setSmallerThanServiceId
public void setSmallerThanServiceId(java.lang.String serviceId)
- 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
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
-