public class MessageGroupQueue extends AbstractQueue<Message<?>> implements BlockingQueue<Message<?>>
BlockingQueue that is backed by a MessageGroupStore. Can be used to ensure guaranteed delivery in
the face of transaction rollback (assuming the store is transactional) and also to ensure messages are not lost if
the process dies (assuming the store is durable). To use the queue across process re-starts, the same group id
must be provided, so it needs to be unique but identifiable with a single logical instance of the queue.| Constructor and Description |
|---|
MessageGroupQueue(BasicMessageGroupStore messageGroupStore,
Object groupId) |
MessageGroupQueue(BasicMessageGroupStore messageGroupStore,
Object groupId,
int capacity) |
MessageGroupQueue(BasicMessageGroupStore messageGroupStore,
Object groupId,
int capacity,
Lock storeLock) |
MessageGroupQueue(BasicMessageGroupStore messageGroupStore,
Object groupId,
Lock storeLock) |
| Modifier and Type | Method and Description |
|---|---|
int |
drainTo(Collection<? super Message<?>> c) |
int |
drainTo(Collection<? super Message<?>> collection,
int maxElements) |
Iterator<Message<?>> |
iterator() |
boolean |
offer(Message<?> message) |
boolean |
offer(Message<?> message,
long timeout,
TimeUnit unit) |
Message<?> |
peek() |
Message<?> |
poll() |
Message<?> |
poll(long timeout,
TimeUnit unit) |
void |
put(Message<?> message) |
int |
remainingCapacity() |
void |
setPriority(boolean priority)
If true, ensures that the message store supports priority.
|
int |
size() |
Message<?> |
take() |
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, contains, removeaddAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraypublic MessageGroupQueue(BasicMessageGroupStore messageGroupStore, Object groupId)
public MessageGroupQueue(BasicMessageGroupStore messageGroupStore, Object groupId, int capacity)
public MessageGroupQueue(BasicMessageGroupStore messageGroupStore, Object groupId, Lock storeLock)
public MessageGroupQueue(BasicMessageGroupStore messageGroupStore, Object groupId, int capacity, Lock storeLock)
public void setPriority(boolean priority)
priority - true if priority is expected to be used.public Iterator<Message<?>> iterator()
iterator in interface Iterable<Message<?>>iterator in interface Collection<Message<?>>iterator in class AbstractCollection<Message<?>>public int size()
size in interface Collection<Message<?>>size in class AbstractCollection<Message<?>>public Message<?> poll(long timeout, TimeUnit unit) throws InterruptedException
poll in interface BlockingQueue<Message<?>>InterruptedExceptionpublic int drainTo(Collection<? super Message<?>> c)
drainTo in interface BlockingQueue<Message<?>>public int drainTo(Collection<? super Message<?>> collection, int maxElements)
drainTo in interface BlockingQueue<Message<?>>public boolean offer(Message<?> message)
public boolean offer(Message<?> message, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<Message<?>>InterruptedExceptionpublic void put(Message<?> message) throws InterruptedException
put in interface BlockingQueue<Message<?>>InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<Message<?>>public Message<?> take() throws InterruptedException
take in interface BlockingQueue<Message<?>>InterruptedException