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"
49 typedef std::vector<Message>
Messages;
51 typedef std::function<void(
Result,
const Message& msg)> ReceiveCallback;
52 typedef std::function<void(
Result,
const Messages& msgs)> BatchReceiveCallback;
53 typedef std::function<void(
Result result,
MessageId messageId)> GetLastMessageIdCallback;
58 typedef std::shared_ptr<ConsumerEventListener> ConsumerEventListenerPtr;
60 struct ConsumerConfigurationImpl;
134 template <
typename T>
137 typename TypedMessage<T>::Decoder decoder) {
138 return setMessageListener([listener, decoder](
Consumer& consumer,
const Message& msg) {
151 bool hasMessageListener()
const;
162 ConsumerEventListenerPtr getConsumerEventListener()
const;
167 bool hasConsumerEventListener()
const;
190 void setReceiverQueueSize(
int size);
195 int getReceiverQueueSize()
const;
205 void setMaxTotalReceiverQueueSizeAcrossPartitions(
int maxTotalReceiverQueueSizeAcrossPartitions);
210 int getMaxTotalReceiverQueueSizeAcrossPartitions()
const;
217 void setConsumerName(
const std::string& consumerName);
222 const std::string& getConsumerName()
const;
234 void setUnAckedMessagesTimeoutMs(
const uint64_t milliSeconds);
239 long getUnAckedMessagesTimeoutMs()
const;
252 void setTickDurationInMs(
const uint64_t milliSeconds);
257 long getTickDurationInMs()
const;
271 void setNegativeAckRedeliveryDelayMs(
long redeliveryDelayMillis);
278 long getNegativeAckRedeliveryDelayMs()
const;
288 void setAckGroupingTimeMs(
long ackGroupingMillis);
295 long getAckGroupingTimeMs()
const;
303 void setAckGroupingMaxSize(
long maxGroupingSize);
310 long getAckGroupingMaxSize()
const;
319 void setBrokerConsumerStatsCacheTimeInMs(
const long cacheTimeInMs);
324 long getBrokerConsumerStatsCacheTimeInMs()
const;
329 bool isEncryptionEnabled()
const;
334 const CryptoKeyReaderPtr getCryptoKeyReader()
const;
346 ConsumerCryptoFailureAction getCryptoFailureAction()
const;
356 bool isReadCompacted()
const;
371 void setReadCompacted(
bool compacted);
380 void setPatternAutoDiscoveryPeriod(
int periodInSeconds);
385 int getPatternAutoDiscoveryPeriod()
const;
406 void setSubscriptionInitialPosition(InitialPosition subscriptionInitialPosition);
411 InitialPosition getSubscriptionInitialPosition()
const;
470 void setReplicateSubscriptionStateEnabled(
bool enabled);
475 bool isReplicateSubscriptionStateEnabled()
const;
484 bool hasProperty(
const std::string& name)
const;
492 const std::string& getProperty(
const std::string& name)
const;
497 std::map<std::string, std::string>& getProperties()
const;
514 std::map<std::string, std::string>& getSubscriptionProperties()
const;
524 const std::map<std::string, std::string>& subscriptionProperties);
537 int getPriorityLevel()
const;
565 size_t getMaxPendingChunkedMessage()
const;
578 bool autoAckOldestChunkedMessageOnQueueFull);
583 bool isAutoAckOldestChunkedMessageOnQueueFull()
const;
595 long expireTimeOfIncompleteChunkedMessageMs);
603 long getExpireTimeOfIncompleteChunkedMessageMs()
const;
617 bool isStartMessageIdInclusive()
const;
634 bool isBatchIndexAckEnabled()
const;
644 const std::vector<ConsumerInterceptorPtr>& getInterceptors()
const;
660 bool isAckReceiptEnabled()
const;
662 friend class PulsarWrapper;
663 friend class PulsarFriend;
666 std::shared_ptr<ConsumerConfigurationImpl> impl_;