pulsar-client-cpp
Loading...
Searching...
No Matches
ConsumerConfiguration.h
1
19#ifndef PULSAR_CONSUMERCONFIGURATION_H_
20#define PULSAR_CONSUMERCONFIGURATION_H_
21
22#include <pulsar/ConsumerCryptoFailureAction.h>
23#include <pulsar/ConsumerEventListener.h>
24#include <pulsar/ConsumerType.h>
25#include <pulsar/CryptoKeyReader.h>
26#include <pulsar/InitialPosition.h>
27#include <pulsar/KeySharedPolicy.h>
28#include <pulsar/Message.h>
29#include <pulsar/Result.h>
30#include <pulsar/Schema.h>
31#include <pulsar/defines.h>
32
33#include <functional>
34#include <memory>
35
36#include "BatchReceivePolicy.h"
37
38namespace pulsar {
39
40class Consumer;
41class PulsarWrapper;
42
44typedef std::vector<Message> Messages;
45typedef std::function<void(Result result)> ResultCallback;
46typedef std::function<void(Result, const Message& msg)> ReceiveCallback;
47typedef std::function<void(Result, const Messages& msgs)> BatchReceiveCallback;
48typedef std::function<void(Result result, MessageId messageId)> GetLastMessageIdCallback;
49
51typedef std::function<void(Consumer consumer, const Message& msg)> MessageListener;
52
53typedef std::shared_ptr<ConsumerEventListener> ConsumerEventListenerPtr;
54
55struct ConsumerConfigurationImpl;
56
60class PULSAR_PUBLIC ConsumerConfiguration {
61 public:
66
72
82
86 const SchemaInfo& getSchema() const;
87
101
106
116
121
128
133
137 bool hasMessageListener() const;
138
143 ConsumerConfiguration& setConsumerEventListener(ConsumerEventListenerPtr eventListener);
144
148 ConsumerEventListenerPtr getConsumerEventListener() const;
149
154
176 void setReceiverQueueSize(int size);
177
182
191 void setMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions);
192
197
203 void setConsumerName(const std::string& consumerName);
204
208 const std::string& getConsumerName() const;
209
220 void setUnAckedMessagesTimeoutMs(const uint64_t milliSeconds);
221
226
238 void setTickDurationInMs(const uint64_t milliSeconds);
239
244
257 void setNegativeAckRedeliveryDelayMs(long redeliveryDelayMillis);
258
265
274 void setAckGroupingTimeMs(long ackGroupingMillis);
275
282
289 void setAckGroupingMaxSize(long maxGroupingSize);
290
297
305 void setBrokerConsumerStatsCacheTimeInMs(const long cacheTimeInMs);
306
311
316
320 const CryptoKeyReaderPtr getCryptoKeyReader() const;
321
327 ConsumerConfiguration& setCryptoKeyReader(CryptoKeyReaderPtr cryptoKeyReader);
328
332 ConsumerCryptoFailureAction getCryptoFailureAction() const;
333
337 ConsumerConfiguration& setCryptoFailureAction(ConsumerCryptoFailureAction action);
338
342 bool isReadCompacted() const;
343
357 void setReadCompacted(bool compacted);
358
366 void setPatternAutoDiscoveryPeriod(int periodInSeconds);
367
372
379 void setSubscriptionInitialPosition(InitialPosition subscriptionInitialPosition);
380
384 InitialPosition getSubscriptionInitialPosition() const;
385
392 void setBatchReceivePolicy(const BatchReceivePolicy& batchReceivePolicy);
393
400
408
413
421 bool hasProperty(const std::string& name) const;
422
429 const std::string& getProperty(const std::string& name) const;
430
434 std::map<std::string, std::string>& getProperties() const;
435
441 ConsumerConfiguration& setProperty(const std::string& name, const std::string& value);
442
446 ConsumerConfiguration& setProperties(const std::map<std::string, std::string>& properties);
447
451 std::map<std::string, std::string>& getSubscriptionProperties() const;
452
461 const std::map<std::string, std::string>& subscriptionProperties);
462
470
474 int getPriorityLevel() const;
475
497 ConsumerConfiguration& setMaxPendingChunkedMessage(size_t maxPendingChunkedMessage);
498
503
515 bool autoAckOldestChunkedMessageOnQueueFull);
516
521
532 long expireTimeOfIncompleteChunkedMessageMs);
533
541
549 ConsumerConfiguration& setStartMessageIdInclusive(bool startMessageIdInclusive);
550
555
556 friend class PulsarWrapper;
557
558 private:
559 std::shared_ptr<ConsumerConfigurationImpl> impl_;
560};
561} // namespace pulsar
562#endif /* PULSAR_CONSUMERCONFIGURATION_H_ */
Definition: BatchReceivePolicy.h:52
Definition: ConsumerConfiguration.h:60
ConsumerConfiguration & setProperties(const std::map< std::string, std::string > &properties)
ConsumerConfiguration & setPriorityLevel(int priorityLevel)
ConsumerType getConsumerType() const
long getBrokerConsumerStatsCacheTimeInMs() const
void setReceiverQueueSize(int size)
MessageListener getMessageListener() const
ConsumerCryptoFailureAction getCryptoFailureAction() const
long getUnAckedMessagesTimeoutMs() const
ConsumerConfiguration & setAutoAckOldestChunkedMessageOnQueueFull(bool autoAckOldestChunkedMessageOnQueueFull)
void setBrokerConsumerStatsCacheTimeInMs(const long cacheTimeInMs)
size_t getMaxPendingChunkedMessage() const
bool isReplicateSubscriptionStateEnabled() const
bool isAutoAckOldestChunkedMessageOnQueueFull() const
ConsumerConfiguration & setConsumerType(ConsumerType consumerType)
int getPatternAutoDiscoveryPeriod() const
ConsumerConfiguration & setKeySharedPolicy(KeySharedPolicy keySharedPolicy)
void setBatchReceivePolicy(const BatchReceivePolicy &batchReceivePolicy)
void setPatternAutoDiscoveryPeriod(int periodInSeconds)
void setAckGroupingMaxSize(long maxGroupingSize)
std::map< std::string, std::string > & getProperties() const
long getExpireTimeOfIncompleteChunkedMessageMs() const
InitialPosition getSubscriptionInitialPosition() const
ConsumerConfiguration & setConsumerEventListener(ConsumerEventListenerPtr eventListener)
const CryptoKeyReaderPtr getCryptoKeyReader() const
void setReplicateSubscriptionStateEnabled(bool enabled)
ConsumerConfiguration & setSchema(const SchemaInfo &schemaInfo)
long getNegativeAckRedeliveryDelayMs() const
bool hasProperty(const std::string &name) const
const std::string & getProperty(const std::string &name) const
void setTickDurationInMs(const uint64_t milliSeconds)
const BatchReceivePolicy & getBatchReceivePolicy() const
bool isStartMessageIdInclusive() const
ConsumerConfiguration & setMessageListener(MessageListener messageListener)
void setConsumerName(const std::string &consumerName)
void setMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions)
ConsumerConfiguration & setMaxPendingChunkedMessage(size_t maxPendingChunkedMessage)
ConsumerConfiguration & setCryptoKeyReader(CryptoKeyReaderPtr cryptoKeyReader)
std::map< std::string, std::string > & getSubscriptionProperties() const
ConsumerConfiguration & setCryptoFailureAction(ConsumerCryptoFailureAction action)
void setSubscriptionInitialPosition(InitialPosition subscriptionInitialPosition)
bool hasConsumerEventListener() const
int getMaxTotalReceiverQueueSizeAcrossPartitions() const
ConsumerConfiguration & setExpireTimeOfIncompleteChunkedMessageMs(long expireTimeOfIncompleteChunkedMessageMs)
ConsumerConfiguration & setProperty(const std::string &name, const std::string &value)
const SchemaInfo & getSchema() const
void setUnAckedMessagesTimeoutMs(const uint64_t milliSeconds)
ConsumerEventListenerPtr getConsumerEventListener() const
KeySharedPolicy getKeySharedPolicy() const
void setReadCompacted(bool compacted)
ConsumerConfiguration clone() const
ConsumerConfiguration & setSubscriptionProperties(const std::map< std::string, std::string > &subscriptionProperties)
void setNegativeAckRedeliveryDelayMs(long redeliveryDelayMillis)
const std::string & getConsumerName() const
void setAckGroupingTimeMs(long ackGroupingMillis)
ConsumerConfiguration & setStartMessageIdInclusive(bool startMessageIdInclusive)
Definition: Consumer.h:36
Definition: KeySharedPolicy.h:52
Definition: Message.h:43
Definition: MessageId.h:34
Definition: Schema.h:144
Definition: Authentication.h:31
std::function< void(Consumer consumer, const Message &msg)> MessageListener
Callback definition for MessageListener.
Definition: ConsumerConfiguration.h:51
ConsumerType
Definition: ConsumerType.h:24
std::vector< Message > Messages
Callback definition for non-data operation.
Definition: ConsumerConfiguration.h:44
std::function< void(Result result)> ResultCallback
Callback definition for non-data operation.
Definition: ConsumerConfiguration.h:45
Result
Definition: Result.h:32