Class OutboxImpl<MessageType>

java.lang.Object
org.apache.druid.messages.server.OutboxImpl<MessageType>
All Implemented Interfaces:
Outbox<MessageType>

public class OutboxImpl<MessageType> extends Object implements Outbox<MessageType>
Production implementation of Outbox. Each outbox is represented by an OutboxImpl.OutboxQueue.
  • 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: Outbox
      Send a message to a client, through an outbox.
      Specified by:
      sendMessage in interface Outbox<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: Outbox
      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 be MessageRelay.INIT, or must match the epoch of the outbox as indicated by MessageBatch.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 in MessageBatch.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:
      getMessages in interface Outbox<MessageType>
      Parameters:
      clientHost - which outbox to retrieve messages from. Each clientHost has its own outbox.
      epoch - outbox epoch, or MessageRelay.INIT if 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

      public void resetOutbox(String clientHost)
      Description copied from interface: Outbox
      Reset the outbox for a particular client. This removes all messages, cancels all outstanding futures, and resets the epoch.
      Specified by:
      resetOutbox in interface Outbox<MessageType>
      Parameters:
      clientHost - the client host:port