19 #ifndef PULSAR_CLIENT_HPP_
20 #define PULSAR_CLIENT_HPP_
22 #include <pulsar/ClientConfiguration.h>
23 #include <pulsar/ConsoleLoggerFactory.h>
24 #include <pulsar/Consumer.h>
25 #include <pulsar/FileLoggerFactory.h>
26 #include <pulsar/Message.h>
27 #include <pulsar/MessageBuilder.h>
28 #include <pulsar/Producer.h>
29 #include <pulsar/Reader.h>
30 #include <pulsar/Result.h>
31 #include <pulsar/Schema.h>
32 #include <pulsar/TableView.h>
33 #include <pulsar/defines.h>
38 typedef std::function<void(
Result, Producer)> CreateProducerCallback;
39 typedef std::function<void(
Result, Consumer)> SubscribeCallback;
40 typedef std::function<void(
Result, Reader)> ReaderCallback;
41 typedef std::function<void(
Result, TableView)> TableViewCallback;
42 typedef std::function<void(
Result,
const std::vector<std::string>&)> GetPartitionsCallback;
43 typedef std::function<void(
Result)> CloseCallback;
58 Client(
const std::string& serviceUrl);
81 Result createProducer(
const std::string& topic,
Producer& producer);
104 void createProducerAsync(
const std::string& topic, CreateProducerCallback callback);
114 CreateProducerCallback callback);
124 Result subscribe(
const std::string& topic,
const std::string& subscriptionName,
Consumer& consumer);
134 Result subscribe(
const std::string& topic,
const std::string& subscriptionName,
146 void subscribeAsync(
const std::string& topic,
const std::string& subscriptionName,
147 SubscribeCallback callback);
159 void subscribeAsync(
const std::string& topic,
const std::string& subscriptionName,
169 Result subscribe(
const std::vector<std::string>& topics,
const std::string& subscriptionName,
180 Result subscribe(
const std::vector<std::string>& topics,
const std::string& subscriptionName,
193 void subscribeAsync(
const std::vector<std::string>& topics,
const std::string& subscriptionName,
194 SubscribeCallback callback);
206 void subscribeAsync(
const std::vector<std::string>& topics,
const std::string& subscriptionName,
212 Result subscribeWithRegex(
const std::string& regexPattern,
const std::string& subscriptionName,
219 Result subscribeWithRegex(
const std::string& regexPattern,
const std::string& subscriptionName,
229 void subscribeWithRegexAsync(
const std::string& regexPattern,
const std::string& subscriptionName,
230 SubscribeCallback callback);
242 void subscribeWithRegexAsync(
const std::string& regexPattern,
const std::string& subscriptionName,
274 Result createReader(
const std::string& topic,
const MessageId& startMessageId,
303 void createReaderAsync(
const std::string& topic,
const MessageId& startMessageId,
334 TableViewCallback callBack);
349 Result getPartitionsForTopic(
const std::string& topic, std::vector<std::string>& partitions);
366 void getPartitionsForTopicAsync(
const std::string& topic, GetPartitionsCallback callback);
383 void closeAsync(CloseCallback callback);
398 uint64_t getNumberOfProducers();
405 uint64_t getNumberOfConsumers();
414 void getSchemaInfoAsync(
const std::string& topic, int64_t version,
419 bool poolConnections);
420 Client(
const std::shared_ptr<ClientImpl>);
422 friend class PulsarFriend;
423 friend class PulsarWrapper;
424 std::shared_ptr<ClientImpl> impl_;