public class AmazonSQSPrioritizedMessageProvider
extends java.lang.Object
implements com.blacklocus.qs.MessageProvider
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator<java.lang.String> |
DEFAULT_QUEUE_COMPARATOR |
| Constructor and Description |
|---|
AmazonSQSPrioritizedMessageProvider(com.amazonaws.services.sqs.AmazonSQS sqs,
java.lang.String queuePrefix,
long updateIntervalMs)
Create a new MessageProvider instance.
|
| Modifier and Type | Method and Description |
|---|---|
long |
currentNanoTime()
A wrapper around System.nanoTime() to encapsulate elapsed time handling
in one place.
|
void |
delete(com.blacklocus.qs.Message message) |
boolean |
hasNext() |
java.util.Iterator<java.util.Collection<com.blacklocus.qs.Message>> |
iterator() |
java.util.List<com.blacklocus.qs.Message> |
next() |
void |
remove() |
boolean |
shouldUpdateQueues()
Returns true if an update to the queues should occur based on the time
since this method was last called.
|
AmazonSQSPrioritizedMessageProvider |
withInclude(com.google.common.base.Predicate<java.lang.String> include)
Queue names that return true for this predicate are included in the list
of available queues to be prioritized.
|
AmazonSQSPrioritizedMessageProvider |
withQueueComparator(java.util.Comparator<java.lang.String> queueComparator)
This comparator controls the sort order of the returned queues.
|
public static final java.util.Comparator<java.lang.String> DEFAULT_QUEUE_COMPARATOR
public AmazonSQSPrioritizedMessageProvider(com.amazonaws.services.sqs.AmazonSQS sqs,
java.lang.String queuePrefix,
long updateIntervalMs)
sqs - AmazonSQS instance to use for communicating with AWSqueuePrefix - the prefix to use when searching for queuesupdateIntervalMs - time in milliseconds between when new queues should be checkedpublic AmazonSQSPrioritizedMessageProvider withInclude(com.google.common.base.Predicate<java.lang.String> include)
include - the predicate to satisfypublic AmazonSQSPrioritizedMessageProvider withQueueComparator(java.util.Comparator<java.lang.String> queueComparator)
queueComparator - the custom sorting comparatorpublic boolean shouldUpdateQueues()
public long currentNanoTime()
public java.util.List<com.blacklocus.qs.Message> next()
next in interface java.util.Iterator<java.util.Collection<com.blacklocus.qs.Message>>public void remove()
remove in interface java.util.Iterator<java.util.Collection<com.blacklocus.qs.Message>>public boolean hasNext()
hasNext in interface java.util.Iterator<java.util.Collection<com.blacklocus.qs.Message>>public java.util.Iterator<java.util.Collection<com.blacklocus.qs.Message>> iterator()
iterator in interface com.blacklocus.qs.QueueItemProvider<com.blacklocus.qs.Message>iterator in interface java.lang.Iterable<java.util.Collection<com.blacklocus.qs.Message>>public void delete(com.blacklocus.qs.Message message)
delete in interface com.blacklocus.qs.MessageProvider