Interface RawReader

All Known Implementing Classes:
RawReaderImpl

public interface RawReader
Topic reader which receives raw messages (i.e. as they are stored in the managed ledger).
  • Method Details

    • create

      static CompletableFuture<RawReader> create(org.apache.pulsar.client.api.PulsarClient client, String topic, String subscription)
      Create a raw reader for a topic.
    • getTopic

      String getTopic()
      Get the topic for the reader.
      Returns:
      topic for the reader
    • hasMessageAvailableAsync

      CompletableFuture<Boolean> hasMessageAvailableAsync()
      Check if there is any message available to read.
      Returns:
      a completable future which will return whether there is any message available to read.
    • seekAsync

      CompletableFuture<Void> seekAsync(org.apache.pulsar.client.api.MessageId messageId)
      Seek to a location in the topic. After the seek, the first message read will be the one with with the specified message ID.
      Parameters:
      messageId - the message ID to seek to
    • readNextAsync

      CompletableFuture<RawMessage> readNextAsync()
      Read the next raw message for the topic.
      Returns:
      a completable future which will return the next RawMessage in the topic.
    • acknowledgeCumulativeAsync

      CompletableFuture<Void> acknowledgeCumulativeAsync(org.apache.pulsar.client.api.MessageId messageId, Map<String,Long> properties)
      Acknowledge all messages as read up until messageId. The properties are stored with the individual acknowledgement, so later acknowledgements will overwrite all properties from previous acknowledgements.
      Parameters:
      messageId - to cumulatively acknowledge to
      properties - a map of properties which will be stored with the acknowledgement
    • getLastMessageIdAsync

      CompletableFuture<org.apache.pulsar.client.api.MessageId> getLastMessageIdAsync()
      Get the last message id available immediately available for reading.
    • closeAsync

      CompletableFuture<Void> closeAsync()
      Close the raw reader.