Package org.apache.druid.messages.server
Class OutboxImpl<MessageType>
java.lang.Object
org.apache.druid.messages.server.OutboxImpl<MessageType>
- All Implemented Interfaces:
Outbox<MessageType>
Production implementation of
Outbox. Each outbox is represented by an OutboxImpl.OutboxQueue.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOutgoing queue for a specific client. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.util.concurrent.ListenableFuture<MessageBatch<MessageType>>getMessages(String clientHost, long epoch, long startWatermark) Get the next batch of messages for an client, from an outbox.voidresetOutbox(String clientHost) Reset the outbox for a particular client.com.google.common.util.concurrent.ListenableFuture<?>sendMessage(String clientHost, MessageType message) Send a message to a client, through an outbox.voidstop()
-
Constructor Details
-
OutboxImpl
public OutboxImpl()
-
-
Method Details
-
stop
public void stop() -
sendMessage
public com.google.common.util.concurrent.ListenableFuture<?> sendMessage(String clientHost, MessageType message) Description copied from interface:OutboxSend a message to a client, through an outbox.- Specified by:
sendMessagein interfaceOutbox<MessageType>- Parameters:
clientHost- which outbox to send messages through. Each clientHost has its own outbox.message- message to send- Returns:
- future that resolves successfully when the client has acknowledged the message
-
getMessages
public com.google.common.util.concurrent.ListenableFuture<MessageBatch<MessageType>> getMessages(String clientHost, long epoch, long startWatermark) Description copied from interface:OutboxGet the next batch of messages for an client, from an outbox. Messages are retrieved in the order they were sent. The provided epoch must either beMessageRelay.INIT, or must match the epoch of the outbox as indicated byMessageBatch.getEpoch()returned by previous calls to the same outbox. If the provided epoch does not match, an empty batch is returned with the correct epoch indicated inMessageBatch.getEpoch(). The provided watermark must be greater than, or equal to, the previous watermark supplied to the same outbox. Any messages lower than the watermark are acknowledged and removed from the outbox.- Specified by:
getMessagesin interfaceOutbox<MessageType>- Parameters:
clientHost- which outbox to retrieve messages from. Each clientHost has its own outbox.epoch- outbox epoch, orMessageRelay.INITif this is the first call from the collector.startWatermark- outbox message watermark to retrieve from.- Returns:
- future that resolves to the next batch of messages
-
resetOutbox
Description copied from interface:OutboxReset the outbox for a particular client. This removes all messages, cancels all outstanding futures, and resets the epoch.- Specified by:
resetOutboxin interfaceOutbox<MessageType>- Parameters:
clientHost- the client host:port
-