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 Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Void> acknowledgeCumulativeAsync​(org.apache.pulsar.client.api.MessageId messageId, java.util.Map<java.lang.String,​java.lang.Long> properties)
      Acknowledge all messages as read up until messageId.
      java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
      Close the raw reader.
      static java.util.concurrent.CompletableFuture<RawReader> create​(org.apache.pulsar.client.api.PulsarClient client, java.lang.String topic, java.lang.String subscription)
      Create a raw reader for a topic.
      java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId> getLastMessageIdAsync()
      Get the last message id available immediately available for reading.
      java.lang.String getTopic()
      Get the topic for the reader.
      java.util.concurrent.CompletableFuture<java.lang.Boolean> hasMessageAvailableAsync()
      Check if there is any message available to read.
      java.util.concurrent.CompletableFuture<RawMessage> readNextAsync()
      Read the next raw message for the topic.
      java.util.concurrent.CompletableFuture<java.lang.Void> seekAsync​(org.apache.pulsar.client.api.MessageId messageId)
      Seek to a location in the topic.
    • Method Detail

      • create

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

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

        java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.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

        java.util.concurrent.CompletableFuture<java.lang.Void> acknowledgeCumulativeAsync​(org.apache.pulsar.client.api.MessageId messageId,
                                                                                          java.util.Map<java.lang.String,​java.lang.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

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

        java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
        Close the raw reader.