public class ReaderImpl<T> extends Object implements Reader<T>
| Constructor and Description |
|---|
ReaderImpl(PulsarClientImpl client,
ReaderConfigurationData<T> readerConfiguration,
ExecutorService listenerExecutor,
CompletableFuture<Consumer<T>> consumerFuture,
Schema<T> schema) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CompletableFuture<Void> |
closeAsync()
Asynchronously close the reader and stop the broker to push more messages
|
ConsumerImpl<T> |
getConsumer() |
String |
getTopic() |
boolean |
hasMessageAvailable()
Check if there is any message available to read from the current position.
|
CompletableFuture<Boolean> |
hasMessageAvailableAsync()
Asynchronously Check if there is message that has been published successfully to the broker in the topic.
|
boolean |
hasReachedEndOfTopic()
Return true if the topic was terminated and this reader has reached the end of the topic
|
boolean |
isConnected() |
Message<T> |
readNext()
Read the next message in the topic
|
Message<T> |
readNext(int timeout,
TimeUnit unit)
Read the next message in the topic waiting for a maximum of timeout
time units.
|
CompletableFuture<Message<T>> |
readNextAsync() |
public ReaderImpl(PulsarClientImpl client, ReaderConfigurationData<T> readerConfiguration, ExecutorService listenerExecutor, CompletableFuture<Consumer<T>> consumerFuture, Schema<T> schema)
public String getTopic()
public ConsumerImpl<T> getConsumer()
public boolean hasReachedEndOfTopic()
ReaderhasReachedEndOfTopic in interface Reader<T>public Message<T> readNext() throws PulsarClientException
ReaderreadNext in interface Reader<T>PulsarClientExceptionpublic Message<T> readNext(int timeout, TimeUnit unit) throws PulsarClientException
ReaderreadNext in interface Reader<T>PulsarClientExceptionpublic CompletableFuture<Message<T>> readNextAsync()
readNextAsync in interface Reader<T>public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic CompletableFuture<Void> closeAsync()
ReadercloseAsync in interface Reader<T>public boolean hasMessageAvailable()
throws PulsarClientException
ReaderhasMessageAvailable in interface Reader<T>PulsarClientExceptionpublic CompletableFuture<Boolean> hasMessageAvailableAsync()
ReaderhasMessageAvailableAsync in interface Reader<T>public boolean isConnected()
isConnected in interface Reader<T>Copyright © 2017–2018 Apache Software Foundation. All rights reserved.