Package org.apache.pulsar.client.api
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
Modifier and TypeMethodDescriptionacknowledgeCumulativeAsync(org.apache.pulsar.client.api.MessageId messageId, Map<String, Long> properties) Acknowledge all messages as read up until messageId.Close the raw reader.static CompletableFuture<RawReader>Create a raw reader for a topic.CompletableFuture<org.apache.pulsar.client.api.MessageId>Get the last message id available immediately available for reading.getTopic()Get the topic for the reader.Check if there is any message available to read.Read the next raw message for the topic.seekAsync(org.apache.pulsar.client.api.MessageId messageId) Seek to a location in the topic.
-
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
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 toproperties- 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.
-