Package org.apache.druid.messages.server
Interface Outbox<MessageType>
- All Known Implementing Classes:
OutboxImpl
public interface Outbox<MessageType>
An outbox for messages sent from servers to clients. Messages are retrieved in the order they are sent.
-
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.
-
Method Details
-
sendMessage
com.google.common.util.concurrent.ListenableFuture<?> sendMessage(String clientHost, MessageType message) Send a message to a client, through an outbox.- 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
com.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. 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.- 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
Reset the outbox for a particular client. This removes all messages, cancels all outstanding futures, and resets the epoch.- Parameters:
clientHost- the client host:port
-