pulsar-client-cpp
Loading...
Searching...
No Matches
Reader.h
1
19#ifndef PULSAR_READER_HPP_
20#define PULSAR_READER_HPP_
21
22#include <pulsar/Message.h>
23#include <pulsar/ReaderConfiguration.h>
24#include <pulsar/defines.h>
25
26namespace pulsar {
27class PulsarWrapper;
28class PulsarFriend;
29class ReaderImpl;
30
31typedef std::function<void(Result result, bool hasMessageAvailable)> HasMessageAvailableCallback;
32typedef std::function<void(Result result, const Message& message)> ReadNextCallback;
33
37class PULSAR_PUBLIC Reader {
38 public:
43
47 const std::string& getTopic() const;
48
60
70 Result readNext(Message& msg, int timeoutMs);
71
77 void readNextAsync(ReadNextCallback callback);
78
85
91 void closeAsync(ResultCallback callback);
92
96 void hasMessageAvailableAsync(HasMessageAvailableCallback callback);
97
101 Result hasMessageAvailable(bool& hasMessageAvailable);
102
113 Result seek(const MessageId& msgId);
114
121 Result seek(uint64_t timestamp);
122
133 void seekAsync(const MessageId& msgId, ResultCallback callback);
134
141 void seekAsync(uint64_t timestamp, ResultCallback callback);
142
146 bool isConnected() const;
147
152 void getLastMessageIdAsync(GetLastMessageIdCallback callback);
153
158
159 private:
160 typedef std::shared_ptr<ReaderImpl> ReaderImplPtr;
161 ReaderImplPtr impl_;
162 explicit Reader(ReaderImplPtr);
163
164 friend class PulsarFriend;
165 friend class PulsarWrapper;
166 friend class ReaderImpl;
167 friend class TableViewImpl;
168 friend class ReaderTest;
169};
170} // namespace pulsar
171
172#endif /* PULSAR_READER_HPP_ */
Definition Message.h:44
Definition MessageId.h:34
Definition Reader.h:37
void hasMessageAvailableAsync(HasMessageAvailableCallback callback)
Result readNext(Message &msg)
const std::string & getTopic() const
void readNextAsync(ReadNextCallback callback)
void getLastMessageIdAsync(GetLastMessageIdCallback callback)
void closeAsync(ResultCallback callback)
Result readNext(Message &msg, int timeoutMs)
Result seek(const MessageId &msgId)
Result hasMessageAvailable(bool &hasMessageAvailable)
Result getLastMessageId(MessageId &messageId)
bool isConnected() const
Result close()
void seekAsync(const MessageId &msgId, ResultCallback callback)
void seekAsync(uint64_t timestamp, ResultCallback callback)
Result seek(uint64_t timestamp)
Definition Authentication.h:31
std::function< void(Result result)> ResultCallback
Callback definition for non-data operation.
Definition ConsumerConfiguration.h:50
Result
Definition Result.h:32