public class MessageQueue extends Object
AbstractMessageRouter and offers
the ability to attempt to wait for the queue to drain.| Modifier and Type | Class and Description |
|---|---|
static class |
MessageQueue.MaxTimeoutHolder
Helper class to enable constructor injection of an optionally configured timeout value.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
MESSAGE_QUEUE_ID |
static String |
PROPERTY_MESSAGE_QUEUE_SHUTDOWN_MAX_TIMEOUT |
| Constructor and Description |
|---|
MessageQueue(DelayQueue<DelayableImmutableMessage> delayableImmutableMessages,
MessageQueue.MaxTimeoutHolder maxTimeoutHolder,
String messageQueueId,
MessagePersister messagePersister,
RoutingTable routingTable) |
| Modifier and Type | Method and Description |
|---|---|
DelayableImmutableMessage |
poll(long timeout,
TimeUnit unit)
Polls the message queue for a period no longer than the timeout specified for a new message.
|
void |
put(DelayableImmutableMessage delayableImmutableMessage)
Add the passed in message to the queue of messages to be processed.
|
public static final String MESSAGE_QUEUE_ID
public static final String PROPERTY_MESSAGE_QUEUE_SHUTDOWN_MAX_TIMEOUT
@Inject public MessageQueue(DelayQueue<DelayableImmutableMessage> delayableImmutableMessages, MessageQueue.MaxTimeoutHolder maxTimeoutHolder, String messageQueueId, MessagePersister messagePersister, RoutingTable routingTable)
public void put(DelayableImmutableMessage delayableImmutableMessage)
delayableImmutableMessage - the message to add.public DelayableImmutableMessage poll(long timeout, TimeUnit unit) throws InterruptedException
timeout - the maximum time to wait for a message to become available.unit - the time unit of measurement for timeoutnull if none became available within the specified time limit.InterruptedException - if the thread was interrupted while waiting for a message to become available.Copyright © 2021. All rights reserved.