Package com.attivio.transport
Class DestinationQueue
- java.lang.Object
-
- com.attivio.transport.DestinationQueue
-
- All Implemented Interfaces:
java.lang.Cloneable,java.lang.Iterable<java.net.URI>
public class DestinationQueue extends java.lang.Object implements java.lang.Iterable<java.net.URI>, java.lang.CloneableWorkflowQueues 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.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ROUTE_IMMEDIATELYDefault value for route immediately
-
Constructor Summary
Constructors Constructor Description DestinationQueue(boolean routeImmediately, java.net.URI... wfs)Constructor.DestinationQueue(java.net.URI... wfs)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(java.net.URI... dests)Adds an ordered list of workflows to the end of this queue.DestinationQueueclone()booleanequals(java.lang.Object o)Checks for equal based on routing flags and workflow names.java.net.URIgetFirst()Gets but does not remove the first entry from the destination list.inthashCode()voidinsert(java.net.URI dst, int position)Adds the destinationdstto the queue at the specifiedposition.booleanisRouteImmediately()booleanisSameEndpointOrder(DestinationQueue queue)Determines if the passed in DestinationQueue has the same workflows in the same order as this.java.util.Iterator<java.net.URI>iterator()Gets an iterator that iterates over all the destinations in the queue.voidprepend(DestinationQueue wfq)adds all the workflows inwfqto the start of our queuevoidprepend(java.net.URI dest)Adds a new workflow to the start of this queue.booleanremove(java.lang.String wf)Removes the first occurrence a specific workflow from this queue.java.net.URIremoveFirst()Gets and removes the first entry from the queue.voidsetRouteImmediately(boolean routeImmediately)Sets the 'route immediately' flag.intsize()Gets the size of the queue.java.lang.StringtoString()A simple single line representation.
-
-
-
Field Detail
-
DEFAULT_ROUTE_IMMEDIATELY
public static final boolean DEFAULT_ROUTE_IMMEDIATELY
Default value for route immediately- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DestinationQueue
public DestinationQueue(java.net.URI... wfs)
Constructor. Creates a queue based on a given set of workflow names.- Parameters:
wfs- the workflow names
-
DestinationQueue
public DestinationQueue(boolean routeImmediately, java.net.URI... 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.net.URI... dests)
Adds an ordered list of workflows to the end of this queue.Performs basic checking for null and empty string workflow names.
-
insert
public void insert(java.net.URI dst, int position)Adds the destinationdstto the queue at the specifiedposition.- Parameters:
dst-position- where to insert thedst. if invalid, thedstis added at the end.
-
removeFirst
public java.net.URI removeFirst()
Gets and removes the first entry from the queue.- Returns:
- the first entry
-
prepend
public void prepend(java.net.URI dest)
Adds a new workflow to the start of this queue.- Parameters:
dest- the workflow to add
-
remove
public boolean remove(java.lang.String wf) throws java.net.URISyntaxExceptionRemoves the first occurrence a specific workflow from this queue.- Parameters:
wf- the workflow to remove- Returns:
- true if successfully removed
- Throws:
java.net.URISyntaxException
-
getFirst
public java.net.URI getFirst()
Gets but does not remove the first entry from the destination list.- Returns:
- the first entry
-
iterator
public java.util.Iterator<java.net.URI> iterator()
Gets an iterator that iterates over all the destinations in the queue.- Specified by:
iteratorin interfacejava.lang.Iterable<java.net.URI>- 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:
equalsin classjava.lang.Object
-
isSameEndpointOrder
public boolean isSameEndpointOrder(DestinationQueue queue)
Determines if the passed in DestinationQueue 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:
hashCodein classjava.lang.Object
-
clone
public DestinationQueue clone()
- Overrides:
clonein classjava.lang.Object
-
toString
public java.lang.String toString()
A simple single line representation.- Overrides:
toStringin classjava.lang.Object
-
prepend
public void prepend(DestinationQueue wfq)
adds all the workflows inwfqto the start of our queue- Parameters:
wfq-
-
-