pulsar-client-cpp
Loading...
Searching...
No Matches
ConsumerConfiguration.h
1
19#ifndef PULSAR_CONSUMERCONFIGURATION_H_
20#define PULSAR_CONSUMERCONFIGURATION_H_
21
22#include <functional>
23#include <memory>
24#include <pulsar/defines.h>
25#include <pulsar/Result.h>
26#include <pulsar/ConsumerType.h>
27#include <pulsar/Message.h>
28#include <pulsar/Schema.h>
29#include <pulsar/ConsumerCryptoFailureAction.h>
30#include <pulsar/CryptoKeyReader.h>
31#include <pulsar/InitialPosition.h>
32#include <pulsar/KeySharedPolicy.h>
33#include <pulsar/ConsumerEventListener.h>
34
35namespace pulsar {
36
37class Consumer;
38class PulsarWrapper;
39
41typedef std::function<void(Result result)> ResultCallback;
42typedef std::function<void(Result, const Message& msg)> ReceiveCallback;
43
45typedef std::function<void(Consumer consumer, const Message& msg)> MessageListener;
46
47typedef std::shared_ptr<ConsumerEventListener> ConsumerEventListenerPtr;
48
49struct ConsumerConfigurationImpl;
50
54class PULSAR_PUBLIC ConsumerConfiguration {
55 public:
60
66
76
80 const SchemaInfo& getSchema() const;
81
95
100
110
115
122
127
131 bool hasMessageListener() const;
132
137 ConsumerConfiguration& setConsumerEventListener(ConsumerEventListenerPtr eventListener);
138
142 ConsumerEventListenerPtr getConsumerEventListener() const;
143
148
170 void setReceiverQueueSize(int size);
171
176
185 void setMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions);
186
191
197 void setConsumerName(const std::string& consumerName);
198
202 const std::string& getConsumerName() const;
203
214 void setUnAckedMessagesTimeoutMs(const uint64_t milliSeconds);
215
220
232 void setTickDurationInMs(const uint64_t milliSeconds);
233
238
251 void setNegativeAckRedeliveryDelayMs(long redeliveryDelayMillis);
252
259
268 void setAckGroupingTimeMs(long ackGroupingMillis);
269
276
283 void setAckGroupingMaxSize(long maxGroupingSize);
284
291
299 void setBrokerConsumerStatsCacheTimeInMs(const long cacheTimeInMs);
300
305
310
314 const CryptoKeyReaderPtr getCryptoKeyReader() const;
315
321 ConsumerConfiguration& setCryptoKeyReader(CryptoKeyReaderPtr cryptoKeyReader);
322
326 ConsumerCryptoFailureAction getCryptoFailureAction() const;
327
331 ConsumerConfiguration& setCryptoFailureAction(ConsumerCryptoFailureAction action);
332
336 bool isReadCompacted() const;
337
351 void setReadCompacted(bool compacted);
352
360 void setPatternAutoDiscoveryPeriod(int periodInSeconds);
361
366
373 void setSubscriptionInitialPosition(InitialPosition subscriptionInitialPosition);
374
378 InitialPosition getSubscriptionInitialPosition() const;
379
387
392
400 bool hasProperty(const std::string& name) const;
401
408 const std::string& getProperty(const std::string& name) const;
409
413 std::map<std::string, std::string>& getProperties() const;
414
420 ConsumerConfiguration& setProperty(const std::string& name, const std::string& value);
421
425 ConsumerConfiguration& setProperties(const std::map<std::string, std::string>& properties);
426
434
438 int getPriorityLevel() const;
439
461 ConsumerConfiguration& setMaxPendingChunkedMessage(size_t maxPendingChunkedMessage);
462
467
479 bool autoAckOldestChunkedMessageOnQueueFull);
480
485
486 friend class PulsarWrapper;
487
488 private:
489 std::shared_ptr<ConsumerConfigurationImpl> impl_;
490};
491} // namespace pulsar
492#endif /* PULSAR_CONSUMERCONFIGURATION_H_ */
Definition: ConsumerConfiguration.h:54
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 setPatternAutoDiscoveryPeriod(int periodInSeconds)
void setAckGroupingMaxSize(long maxGroupingSize)
std::map< std::string, std::string > & getProperties() 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)
ConsumerConfiguration & setMessageListener(MessageListener messageListener)
void setConsumerName(const std::string &consumerName)
void setMaxTotalReceiverQueueSizeAcrossPartitions(int maxTotalReceiverQueueSizeAcrossPartitions)
ConsumerConfiguration & setMaxPendingChunkedMessage(size_t maxPendingChunkedMessage)
ConsumerConfiguration & setCryptoKeyReader(CryptoKeyReaderPtr cryptoKeyReader)
ConsumerConfiguration & setCryptoFailureAction(ConsumerCryptoFailureAction action)
void setSubscriptionInitialPosition(InitialPosition subscriptionInitialPosition)
bool hasConsumerEventListener() const
int getMaxTotalReceiverQueueSizeAcrossPartitions() const
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
void setNegativeAckRedeliveryDelayMs(long redeliveryDelayMillis)
const std::string & getConsumerName() const
void setAckGroupingTimeMs(long ackGroupingMillis)
Definition: Consumer.h:35
Definition: KeySharedPolicy.h:53
Definition: Message.h:42
Definition: Schema.h:123
Definition: Authentication.h:30
std::function< void(Consumer consumer, const Message &msg)> MessageListener
Callback definition for MessageListener.
Definition: ConsumerConfiguration.h:45
ConsumerType
Definition: ConsumerType.h:24
std::function< void(Result result)> ResultCallback
Callback definition for non-data operation.
Definition: ConsumerConfiguration.h:41
Result
Definition: Result.h:31