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.

  • Constructor Details

    • SizeBasedBranchingService

      public SizeBasedBranchingService()
      Creates a new instance.

      size-criteria-bytes = 1024 * 1024 * 10 (10Mb)

  • Method Details

    • initService

      protected void initService() throws CoreException
      Specified by:
      initService in class ServiceImp
      Throws:
      CoreException
    • closeService

      protected void closeService()
      Specified by:
      closeService in class ServiceImp
    • doService

      public void doService(AdaptrisMessage msg) throws ServiceException
      Description copied from interface: Service

      Apply the service to the message.

      Parameters:
      msg - the AdaptrisMessage to process
      Throws:
      ServiceException - wrapping any underlying Exceptions
    • getGreaterThanServiceId

      public String getGreaterThanServiceId()
      Returns:
      the greaterThanServiceId
    • setGreaterThanServiceId

      public void setGreaterThanServiceId(String serviceId)
      Parameters:
      serviceId - the greaterThanServiceId to set
    • getSmallerThanServiceId

      public String getSmallerThanServiceId()
      Returns:
      the smallerThanServiceId
    • setSmallerThanServiceId

      public void setSmallerThanServiceId(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