Class CompactionReaderImpl<T>

java.lang.Object
org.apache.pulsar.client.impl.ReaderImpl<T>
org.apache.pulsar.client.impl.CompactionReaderImpl<T>
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.pulsar.client.api.Reader<T>

public class CompactionReaderImpl<T> extends ReaderImpl<T>
An extended ReaderImpl used for StrategicTwoPhaseCompactor. The compaction consumer subscription is durable and consumes compacted messages from the earliest position. It does not acknowledge the message after each read. (needs to call acknowledgeCumulativeAsync to ack messages.)
  • Method Details

    • create

      public static <T> CompactionReaderImpl<T> create(PulsarClientImpl client, org.apache.pulsar.client.api.Schema<T> schema, String topic, CompletableFuture<org.apache.pulsar.client.api.Consumer<T>> consumerFuture, org.apache.pulsar.client.api.CryptoKeyReader cryptoKeyReader)
    • readNext

      public org.apache.pulsar.client.api.Message<T> readNext() throws org.apache.pulsar.client.api.PulsarClientException
      Specified by:
      readNext in interface org.apache.pulsar.client.api.Reader<T>
      Overrides:
      readNext in class ReaderImpl<T>
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • readNext

      public org.apache.pulsar.client.api.Message<T> readNext(int timeout, TimeUnit unit) throws org.apache.pulsar.client.api.PulsarClientException
      Specified by:
      readNext in interface org.apache.pulsar.client.api.Reader<T>
      Overrides:
      readNext in class ReaderImpl<T>
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • readNextAsync

      public CompletableFuture<org.apache.pulsar.client.api.Message<T>> readNextAsync()
      Specified by:
      readNextAsync in interface org.apache.pulsar.client.api.Reader<T>
      Overrides:
      readNextAsync in class ReaderImpl<T>
    • getLastMessageIdAsync

      public CompletableFuture<org.apache.pulsar.client.api.MessageId> getLastMessageIdAsync()
    • acknowledgeCumulativeAsync

      public CompletableFuture<Void> acknowledgeCumulativeAsync(org.apache.pulsar.client.api.MessageId messageId, Map<String,Long> properties)