Class WorkflowQueue

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>

    public class WorkflowQueue
    extends java.lang.Object
    implements java.lang.Iterable<java.lang.String>, java.lang.Cloneable, java.io.Serializable
    WorkflowQueues model the message flow for their associated message.

    A queue has an ordered list of workflow names to execute as well as flags to indicate when and how that routing should occur. After each component finishes processing an input message, the contents of the WorfklowQueue are part of the information used to determine where the message will go next. If the routeImmediately flag is set the head of the queue determines the next destination for the message. If this flag is not set, then message will be routed to the next component in the current workflow. If there are no more components in the workflow, then the head of the workflow queue is used.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean DEFAULT_ROUTE_IMMEDIATELY
      Default value for route immediately
    • Constructor Summary

      Constructors 
      Constructor Description
      WorkflowQueue​(boolean routeImmediately, java.lang.String... wfs)
      Constructor.
      WorkflowQueue​(java.lang.String... wfs)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(java.lang.String... wfs)
      Adds an ordered list of workflows to the end of this queue.
      WorkflowQueue clone()
      boolean contains​(java.lang.String destination)
      True is this queue already contains the destination provided.
      boolean equals​(java.lang.Object o)
      Checks for equal based on routing flags and workflow names.
      java.lang.String get​(int position)  
      java.lang.String getFirst()
      Gets but does not remove the first entry from the workflow list.
      int hashCode()
      void insert​(java.lang.String wf, int position)
      Adds the workflow wf to the queue at the specified position.
      boolean isRemote()
      Indicates that the list of workflows will cause the system to be routed off the current node node.
      boolean isRouteImmediately()  
      boolean isSameWorkflowOrder​(WorkflowQueue queue)
      Determines if the passed in WorkflowQueue has the same workflows in the same order as this.
      java.util.Iterator<java.lang.String> iterator()
      Gets an iterator that iterates over all the workflows in the queue.
      void prepend​(WorkflowQueue wfq)
      adds all the workflows in wfq to the start of our queue
      void prepend​(java.lang.String wf)
      Adds a new workflow to the start of this queue.
      boolean remove​(java.lang.String wf)
      Removes the first occurrence a specific workflow from this queue.
      java.lang.String removeFirst()
      Gets and removes the first entry from the queue.
      java.lang.String replace​(int position, java.lang.String s)  
      void setRemote​(boolean remote)  
      void setRouteImmediately​(boolean routeImmediately)
      Sets the 'route immediately' flag.
      int size()
      Gets the size of the queue.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • DEFAULT_ROUTE_IMMEDIATELY

        public static final boolean DEFAULT_ROUTE_IMMEDIATELY
        Default value for route immediately
        See Also:
        Constant Field Values
    • Constructor Detail

      • WorkflowQueue

        public WorkflowQueue​(java.lang.String... wfs)
        Constructor. Creates a queue based on a given set of workflow names.
        Parameters:
        wfs - the workflow names
      • WorkflowQueue

        public WorkflowQueue​(boolean routeImmediately,
                             java.lang.String... wfs)
        Constructor. Creates a queue based on a given set of workflow names.
        Parameters:
        routeImmediately -
        wfs - the workflow names
    • Method Detail

      • append

        public void append​(java.lang.String... wfs)
        Adds an ordered list of workflows to the end of this queue.

        Performs basic checking for null and empty string workflow names.

        Parameters:
        wfs - the workflows
      • insert

        public void insert​(java.lang.String wf,
                           int position)
        Adds the workflow wf to the queue at the specified position.
        Parameters:
        wf -
        position - where to insert the wf. if invalid, the wf is added at the end.
      • removeFirst

        public java.lang.String removeFirst()
        Gets and removes the first entry from the queue.
        Returns:
        the first entry
      • prepend

        public void prepend​(java.lang.String wf)
        Adds a new workflow to the start of this queue.
        Parameters:
        wf - the workflow to add
      • remove

        public boolean remove​(java.lang.String wf)
        Removes the first occurrence a specific workflow from this queue.
        Parameters:
        wf - the workflow to remove
        Returns:
        true if successfully removed
      • getFirst

        public java.lang.String getFirst()
        Gets but does not remove the first entry from the workflow list.
        Returns:
        the first entry
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Gets an iterator that iterates over all the workflows in the queue.
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
        Returns:
        the iterator
      • size

        public int size()
        Gets the size of the queue.
        Returns:
        the size
      • isRouteImmediately

        public boolean isRouteImmediately()
      • setRouteImmediately

        public void setRouteImmediately​(boolean routeImmediately)
        Sets the 'route immediately' flag.
        Parameters:
        routeImmediately - the route immediately flag
      • equals

        public boolean equals​(java.lang.Object o)
        Checks for equal based on routing flags and workflow names.
        Overrides:
        equals in class java.lang.Object
      • isSameWorkflowOrder

        public boolean isSameWorkflowOrder​(WorkflowQueue queue)
        Determines if the passed in WorkflowQueue has the same workflows in the same order as this.
        Parameters:
        queue - the workflow queue
        Returns:
        true if the workflow queue has the same workflows in the same order
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • clone

        public WorkflowQueue clone()
        Overrides:
        clone in class java.lang.Object
      • prepend

        public void prepend​(WorkflowQueue wfq)
        adds all the workflows in wfq to the start of our queue
        Parameters:
        wfq -
      • isRemote

        public boolean isRemote()
        Indicates that the list of workflows will cause the system to be routed off the current node node. This should not be an authoritative source of information for the negative case. It is only useful for the positive case and generally set by features that generate complex configurations that are known to route messages off node.
      • setRemote

        public void setRemote​(boolean remote)
      • get

        public java.lang.String get​(int position)
      • replace

        public java.lang.String replace​(int position,
                                        java.lang.String s)
      • contains

        public boolean contains​(java.lang.String destination)
        True is this queue already contains the destination provided.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object