19#ifndef PULSAR_CONSUMERCONFIGURATION_H_
20#define PULSAR_CONSUMERCONFIGURATION_H_
22#include <pulsar/ConsumerCryptoFailureAction.h>
23#include <pulsar/ConsumerEventListener.h>
24#include <pulsar/ConsumerInterceptor.h>
25#include <pulsar/ConsumerType.h>
26#include <pulsar/CryptoKeyReader.h>
27#include <pulsar/InitialPosition.h>
28#include <pulsar/KeySharedPolicy.h>
29#include <pulsar/Message.h>
30#include <pulsar/RegexSubscriptionMode.h>
31#include <pulsar/Result.h>
32#include <pulsar/Schema.h>
33#include <pulsar/TypedMessage.h>
34#include <pulsar/defines.h>
39#include "BatchReceivePolicy.h"
40#include "DeadLetterPolicy.h"
51typedef std::function<void(
Result,
const Message& msg)> ReceiveCallback;
52typedef std::function<void(
Result,
const Messages& msgs)> BatchReceiveCallback;
53typedef std::function<void(
Result result,
MessageId messageId)> GetLastMessageIdCallback;
58typedef std::shared_ptr<ConsumerEventListener> ConsumerEventListenerPtr;
60struct ConsumerConfigurationImpl;
134 template <
typename T>
137 typename TypedMessage<T>::Decoder decoder) {
138 return setMessageListener([listener, decoder](
Consumer& consumer,
const Message& msg) {
524 const std::map<std::string, std::string>& subscriptionProperties);
578 bool autoAckOldestChunkedMessageOnQueueFull);
595 long expireTimeOfIncompleteChunkedMessageMs);
644 const std::vector<ConsumerInterceptorPtr>& getInterceptors()
const;
662 friend class PulsarWrapper;
663 friend class PulsarFriend;
666 std::shared_ptr<ConsumerConfigurationImpl> impl_;
Definition BatchReceivePolicy.h:52
Definition ConsumerConfiguration.h:65
ConsumerConfiguration & setProperties(const std::map< std::string, std::string > &properties)
ConsumerConfiguration & setPriorityLevel(int priorityLevel)
const DeadLetterPolicy & getDeadLetterPolicy() const
ConsumerConfiguration & setBatchIndexAckEnabled(bool enabled)
ConsumerType getConsumerType() const
bool isBatchIndexAckEnabled() const
long getBrokerConsumerStatsCacheTimeInMs() const
void setReceiverQueueSize(int size)
long getTickDurationInMs() const
MessageListener getMessageListener() const
ConsumerCryptoFailureAction getCryptoFailureAction() const
long getUnAckedMessagesTimeoutMs() const
ConsumerConfiguration & intercept(const std::vector< ConsumerInterceptorPtr > &interceptors)
ConsumerConfiguration & setAutoAckOldestChunkedMessageOnQueueFull(bool autoAckOldestChunkedMessageOnQueueFull)
ConsumerConfiguration & setAckReceiptEnabled(bool ackReceiptEnabled)
void setBrokerConsumerStatsCacheTimeInMs(const long cacheTimeInMs)
size_t getMaxPendingChunkedMessage() const
int getPriorityLevel() const
bool isReplicateSubscriptionStateEnabled() const
bool isAutoAckOldestChunkedMessageOnQueueFull() const
ConsumerConfiguration & setConsumerType(ConsumerType consumerType)
int getPatternAutoDiscoveryPeriod() const
ConsumerConfiguration & setRegexSubscriptionMode(RegexSubscriptionMode regexSubscriptionMode)
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
int getReceiverQueueSize() const
long getExpireTimeOfIncompleteChunkedMessageMs() const
InitialPosition getSubscriptionInitialPosition() const
long getAckGroupingMaxSize() const
ConsumerConfiguration & setConsumerEventListener(ConsumerEventListenerPtr eventListener)
const CryptoKeyReaderPtr getCryptoKeyReader() const
void setReplicateSubscriptionStateEnabled(bool enabled)
bool isReadCompacted() const
RegexSubscriptionMode getRegexSubscriptionMode() const
ConsumerConfiguration & setSchema(const SchemaInfo &schemaInfo)
long getNegativeAckRedeliveryDelayMs() const
void setDeadLetterPolicy(const DeadLetterPolicy &deadLetterPolicy)
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
long getAckGroupingTimeMs() const
int getMaxTotalReceiverQueueSizeAcrossPartitions() const
ConsumerConfiguration & setExpireTimeOfIncompleteChunkedMessageMs(long expireTimeOfIncompleteChunkedMessageMs)
bool isEncryptionEnabled() 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
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)
bool isAckReceiptEnabled() const
bool hasMessageListener() const
Definition DeadLetterPolicy.h:36
Definition KeySharedPolicy.h:52
Definition MessageId.h:34
Definition TypedMessage.h:28
Definition Authentication.h:31
std::function< void(Consumer &consumer, const Message &msg)> MessageListener
Callback definition for MessageListener.
Definition ConsumerConfiguration.h:56
RegexSubscriptionMode
Definition RegexSubscriptionMode.h:24
ConsumerType
Definition ConsumerType.h:24
std::vector< Message > Messages
Callback definition for non-data operation.
Definition ConsumerConfiguration.h:49
std::function< void(Result result)> ResultCallback
Callback definition for non-data operation.
Definition ConsumerConfiguration.h:50
Result
Definition Result.h:32