public interface TrackingQueue
Modifier and Type | Interface and Description |
---|---|
static class |
TrackingQueue.ConsumingStatus
Defines Tracking Queue Consuming Status.
|
static class |
TrackingQueue.PossessionState
Defines PossessionState.
|
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<String> |
add(Element element)
Adds element to the queue.
|
Iterator<QueuedElement> |
getBeingConsumed()
Get all
QueuedElement that are being consumed. |
Iterator<QueuedElement> |
getQueued()
Get all
QueuedElement in the queue that are not being consumed. |
TrackingQueue.PossessionState |
recordProgress(String consumerId,
String elementId,
TrackingQueue.ConsumingStatus status,
String result)
Records progress of consuming the element.
|
boolean |
remove(String elementId)
Removes element from the queue by element id.
|
boolean |
removeAll()
Removes all elements from the queue.
|
int |
size()
Get the size of the queue (both queued and being consumed).
|
Element |
take(String consumerId)
Take next available element from the queue act on it.
|
boolean |
toHighestPriority(String elementId)
Promotes element to the top of the queue.
|
com.google.common.util.concurrent.ListenableFuture<String> add(Element element)
element
- to addElement take(String consumerId)
After element is taken it is no longer available for others to take unless it is not placed back to queue. Element can be placed back in the following cases:
add(Element)
method. In this case element will
be considered a new element never seen before.
Element will not be removed from list of "in-progress" elements list automatically.
TrackingQueue.ConsumingStatus.FAILED
status via
recordProgress(String, String, ConsumingStatus, String)
.
Element will be rescheduled automatically and removed from the "in-progress" list.
consumerId
- element consumerTrackingQueue.PossessionState recordProgress(String consumerId, String elementId, TrackingQueue.ConsumingStatus status, String result)
TrackingQueue.PossessionState.NOT_POSSESSES
. This may happen e.g. if TrackingQueue
implementation decided that this consumer is dead and put it back to queue.
If TrackingQueue.ConsumingStatus.FAILED
status is reported,
element will be placed back to queue automatically
If TrackingQueue.ConsumingStatus.FINISHED_SUCCESSFULLY
status is reported
the queue no longer tracks the element consuming status.
consumerId
- consumer that is processing the element and reporting the progresselementId
- element to report progress onstatus
- status of the consuming.result
- current value of the result of consuming.boolean remove(String elementId)
elementId
- id of the element to removeboolean removeAll()
remove(String)
for more details.boolean toHighestPriority(String elementId)
elementId
- id of the element to promoteIterator<QueuedElement> getQueued()
QueuedElement
in the queue that are not being consumed.Iterator<QueuedElement> getBeingConsumed()
QueuedElement
that are being consumed.int size()
Copyright © 2013-2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.