Class RoundRobinRouter

  • All Implemented Interfaces:
    Configurable, Router

    public class RoundRobinRouter
    extends RouterBase
    A router that selects among the next steps in a round-robin fashion. Note that in some cases where a document is being reprocessed and some of the next steps are not suitable for the document's listed destination, this implementation will skip ahead to the next eligible step. Thus, if absolute long term fairness is desired a different router implementation should be selected (or written).
    • Constructor Detail

      • RoundRobinRouter

        public RoundRobinRouter()
    • Method Detail

      • isDeterministic

        public boolean isDeterministic()
        Description copied from interface: Router
        Indicates if this router will always route an identical document to the same downstream step or steps. It is important to understand that this attribute refers to determinism with respect to document content and anything that depends on the order in which documents are fed, is NOT deterministic.
        Returns:
        True if the document's destination is deterministic, false if it may vary.
      • isConstantNumberOfOutputDocs

        public boolean isConstantNumberOfOutputDocs()
        Description copied from interface: Router
        Indicates if the number documents entering this router have a constant linear relationship to the number of documents exiting the router. This relationship need only be constant for a particular plan configuration, and may vary when configured differently in different plans. A document may be considered to have exited the router if it records a terminal status (i.e. Status.DROPPED, or if it is included in the NextSteps object returned from Router.route(Document)
        Returns:
        True if one document in produces a constant number of documents out.
      • getNumberOfOutputCopies

        public int getNumberOfOutputCopies()
        Description copied from interface: Router
        Indicates how many copies of a document may be omitted by this router. If Router.isConstantNumberOfOutputDocs() returns false this number represents the maximum output. A negative value indicates that there is no constraint on the number of copies that may be omitted.
        Returns:
        the number of output copies expected.
      • route

        public NextSteps route​(Document doc)
        Description copied from interface: Router
        Decide where to send this document. The result may represent some or all of the steps down stream. Note that it is illegal for a router not to select at least one destination, and this will cause errors. It is also prohibited for the router to select a destination not listed on the document.
        Parameters:
        doc - The document to route
        Returns:
        An object encapsulating the destinations to which the document (or copies of it) will be sent.
        See Also:
        Step.getEligibleNextSteps(Document)
      • getName

        public java.lang.String getName()
        Description copied from interface: Configurable
        A name for this object to distinguish it from other objects. This value is generally supplied by the plan author. Every object in a plan must have a unique name, begin with a letter and only contain letters, digits, underscores and periods.
        Returns:
        The user supplied name for this step