pulsar-client-cpp
|
#include <ConsumerConfiguration.h>
Public Member Functions | |
ConsumerConfiguration (const ConsumerConfiguration &) | |
ConsumerConfiguration & | operator= (const ConsumerConfiguration &) |
ConsumerConfiguration & | setConsumerType (ConsumerType consumerType) |
ConsumerType | getConsumerType () const |
ConsumerConfiguration & | setMessageListener (MessageListener messageListener) |
MessageListener | getMessageListener () const |
bool | hasMessageListener () const |
void | setReceiverQueueSize (int size) |
int | getReceiverQueueSize () const |
void | setConsumerName (const std::string &) |
const std::string & | getConsumerName () const |
void | setUnAckedMessagesTimeoutMs (const uint64_t milliSeconds) |
long | getUnAckedMessagesTimeoutMs () const |
void | setBrokerConsumerStatsCacheTimeInMs (const long cacheTimeInMs) |
long | getBrokerConsumerStatsCacheTimeInMs () const |
Friends | |
class | PulsarWrapper |
Class specifying the configuration of a consumer.
long pulsar::ConsumerConfiguration::getBrokerConsumerStatsCacheTimeInMs | ( | ) | const |
long pulsar::ConsumerConfiguration::getUnAckedMessagesTimeoutMs | ( | ) | const |
void pulsar::ConsumerConfiguration::setBrokerConsumerStatsCacheTimeInMs | ( | const long | cacheTimeInMs | ) |
Set the time duration for which the broker side consumer stats will be cached in the client.
cacheTimeInMs | in milliseconds |
ConsumerConfiguration& pulsar::ConsumerConfiguration::setConsumerType | ( | ConsumerType | consumerType | ) |
Specify the consumer type. The consumer type enables specifying the type of subscription. In Exclusive subscription, only a single consumer is allowed to attach to the subscription. Other consumers will get an error message. In Shared subscription, multiple consumers will be able to use the same subscription name and the messages will be dispatched in a round robin fashion. In Failover subscription, a master-slave subscription model allows for multiple consumers to attach to a single subscription, though only one of them will be “master” at a given time. Only the master consumer will receive messages. When the master gets disconnected, one among the slaves will be promoted to master and will start getting messages.
ConsumerConfiguration& pulsar::ConsumerConfiguration::setMessageListener | ( | MessageListener | messageListener | ) |
A message listener enables your application to configure how to process and acknowledge messages delivered. A listener will be called in order for every message received.
void pulsar::ConsumerConfiguration::setReceiverQueueSize | ( | int | size | ) |
Sets the size of the consumer receive queue.
The consumer receive queue controls how many messages can be accumulated by the Consumer before the application calls receive(). Using a higher value could potentially increase the consumer throughput at the expense of bigger memory utilization.
Setting the consumer queue size as zero decreases the throughput of the consumer, by disabling pre-fetching of messages. This approach improves the message distribution on shared subscription, by pushing messages only to the consumers that are ready to process them. Neither receive with timeout nor Partitioned Topics can be used if the consumer queue size is zero. The receive() function call should not be interrupted when the consumer queue size is zero.
Default value is 1000 messages and should be good for most use cases.
size | the new receiver queue size value |
void pulsar::ConsumerConfiguration::setUnAckedMessagesTimeoutMs | ( | const uint64_t | milliSeconds | ) |
Set the timeout in milliseconds for unacknowledged messages, the timeout needs to be greater than 10 seconds. An Exception is thrown if the given value is less than 10000 (10 seconds). If a successful acknowledgement is not sent within the timeout all the unacknowledged messages are redelivered.
timeout | in milliseconds |