Package org.apache.pulsar.client.impl.v1
Class ReaderV1Impl
java.lang.Object
org.apache.pulsar.client.impl.v1.ReaderV1Impl
- All Implemented Interfaces:
Closeable,AutoCloseable,Reader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Asynchronously close the reader and stop the broker to push more messages.getTopic()booleanCheck if there is any message available to read from the current position.Asynchronously Check if there is message that has been published successfully to the broker in the topic.booleanReturn true if the topic was terminated and this reader has reached the end of the topic.booleanorg.apache.pulsar.client.api.Message<byte[]>readNext()Read the next message in the topic.org.apache.pulsar.client.api.Message<byte[]>Read the next message in the topic waiting for a maximum of timeout time units.CompletableFuture<org.apache.pulsar.client.api.Message<byte[]>>
-
Constructor Details
-
ReaderV1Impl
public ReaderV1Impl(org.apache.pulsar.shade.client.api.v2.Reader<byte[]> reader)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
closeAsync
Description copied from interface:ReaderAsynchronously close the reader and stop the broker to push more messages.- Specified by:
closeAsyncin interfaceReader- Returns:
- a future that can be used to track the completion of the operation
-
getTopic
-
hasMessageAvailable
public boolean hasMessageAvailable() throws org.apache.pulsar.client.api.PulsarClientExceptionDescription copied from interface:ReaderCheck if there is any message available to read from the current position.- Specified by:
hasMessageAvailablein interfaceReader- Throws:
org.apache.pulsar.client.api.PulsarClientException
-
hasMessageAvailableAsync
Description copied from interface:ReaderAsynchronously Check if there is message that has been published successfully to the broker in the topic.- Specified by:
hasMessageAvailableAsyncin interfaceReader
-
hasReachedEndOfTopic
public boolean hasReachedEndOfTopic()Description copied from interface:ReaderReturn true if the topic was terminated and this reader has reached the end of the topic.- Specified by:
hasReachedEndOfTopicin interfaceReader
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceReader- Returns:
- Whether the reader is connected to the broker
-
readNext
public org.apache.pulsar.client.api.Message<byte[]> readNext() throws org.apache.pulsar.client.api.PulsarClientExceptionDescription copied from interface:ReaderRead the next message in the topic. -
readNext
public org.apache.pulsar.client.api.Message<byte[]> readNext(int arg0, TimeUnit arg1) throws org.apache.pulsar.client.api.PulsarClientException Description copied from interface:ReaderRead the next message in the topic waiting for a maximum of timeout time units. Returns null if no message is received in that time. -
readNextAsync
- Specified by:
readNextAsyncin interfaceReader
-