Class RawReaderImpl

  • All Implemented Interfaces:
    RawReader

    public class RawReaderImpl
    extends java.lang.Object
    implements RawReader
    • Constructor Summary

      Constructors 
      Constructor Description
      RawReaderImpl​(org.apache.pulsar.client.impl.PulsarClientImpl client, java.lang.String topic, java.lang.String subscription, java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.Consumer<byte[]>> consumerFuture)  
    • Method Summary

      All Methods Instance Methods Concrete 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.
      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.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RawReaderImpl

        public RawReaderImpl​(org.apache.pulsar.client.impl.PulsarClientImpl client,
                             java.lang.String topic,
                             java.lang.String subscription,
                             java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.Consumer<byte[]>> consumerFuture)
    • Method Detail

      • getTopic

        public java.lang.String getTopic()
        Description copied from interface: RawReader
        Get the topic for the reader.
        Specified by:
        getTopic in interface RawReader
        Returns:
        topic for the reader
      • hasMessageAvailableAsync

        public java.util.concurrent.CompletableFuture<java.lang.Boolean> hasMessageAvailableAsync()
        Description copied from interface: RawReader
        Check if there is any message available to read.
        Specified by:
        hasMessageAvailableAsync in interface RawReader
        Returns:
        a completable future which will return whether there is any message available to read.
      • seekAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> seekAsync​(org.apache.pulsar.client.api.MessageId messageId)
        Description copied from interface: RawReader
        Seek to a location in the topic. After the seek, the first message read will be the one with with the specified message ID.
        Specified by:
        seekAsync in interface RawReader
        Parameters:
        messageId - the message ID to seek to
      • readNextAsync

        public java.util.concurrent.CompletableFuture<RawMessage> readNextAsync()
        Description copied from interface: RawReader
        Read the next raw message for the topic.
        Specified by:
        readNextAsync in interface RawReader
        Returns:
        a completable future which will return the next RawMessage in the topic.
      • acknowledgeCumulativeAsync

        public 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)
        Description copied from interface: RawReader
        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.
        Specified by:
        acknowledgeCumulativeAsync in interface RawReader
        Parameters:
        messageId - to cumulatively acknowledge to
        properties - a map of properties which will be stored with the acknowledgement
      • closeAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
        Description copied from interface: RawReader
        Close the raw reader.
        Specified by:
        closeAsync in interface RawReader
      • getLastMessageIdAsync

        public java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.MessageId> getLastMessageIdAsync()
        Description copied from interface: RawReader
        Get the last message id available immediately available for reading.
        Specified by:
        getLastMessageIdAsync in interface RawReader
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object