pulsar-client-cpp
|
#include <ReaderConfiguration.h>
Public Member Functions | |
ReaderConfiguration (const ReaderConfiguration &) | |
ReaderConfiguration & | operator= (const ReaderConfiguration &) |
ReaderConfiguration & | setSchema (const SchemaInfo &schemaInfo) |
const SchemaInfo & | getSchema () const |
ReaderConfiguration & | setReaderListener (ReaderListener listener) |
ReaderListener | getReaderListener () const |
bool | hasReaderListener () const |
void | setReceiverQueueSize (int size) |
int | getReceiverQueueSize () const |
void | setReaderName (const std::string &readerName) |
const std::string & | getReaderName () const |
void | setSubscriptionRolePrefix (const std::string &subscriptionRolePrefix) |
const std::string & | getSubscriptionRolePrefix () const |
void | setReadCompacted (bool compacted) |
bool | isReadCompacted () const |
void | setInternalSubscriptionName (std::string internalSubscriptionName) |
const std::string & | getInternalSubscriptionName () const |
void | setUnAckedMessagesTimeoutMs (const uint64_t milliSeconds) |
long | getUnAckedMessagesTimeoutMs () const |
void | setTickDurationInMs (const uint64_t milliSeconds) |
long | getTickDurationInMs () const |
void | setAckGroupingTimeMs (long ackGroupingMillis) |
long | getAckGroupingTimeMs () const |
void | setAckGroupingMaxSize (long maxGroupingSize) |
long | getAckGroupingMaxSize () const |
bool | isEncryptionEnabled () const |
const CryptoKeyReaderPtr | getCryptoKeyReader () const |
ReaderConfiguration & | setCryptoKeyReader (CryptoKeyReaderPtr cryptoKeyReader) |
ConsumerCryptoFailureAction | getCryptoFailureAction () const |
ReaderConfiguration & | setCryptoFailureAction (ConsumerCryptoFailureAction action) |
ReaderConfiguration & | setStartMessageIdInclusive (bool startMessageIdInclusive) |
bool | isStartMessageIdInclusive () const |
bool | hasProperty (const std::string &name) const |
const std::string & | getProperty (const std::string &name) const |
std::map< std::string, std::string > & | getProperties () const |
ReaderConfiguration & | setProperty (const std::string &name, const std::string &value) |
ReaderConfiguration & | setProperties (const std::map< std::string, std::string > &properties) |
Class specifying the configuration of a consumer.
long pulsar::ReaderConfiguration::getAckGroupingMaxSize | ( | ) | const |
Get max number of grouped messages within one grouping time window.
long pulsar::ReaderConfiguration::getAckGroupingTimeMs | ( | ) | const |
Get grouping time window in milliseconds.
ConsumerCryptoFailureAction pulsar::ReaderConfiguration::getCryptoFailureAction | ( | ) | const |
const CryptoKeyReaderPtr pulsar::ReaderConfiguration::getCryptoKeyReader | ( | ) | const |
const std::string & pulsar::ReaderConfiguration::getInternalSubscriptionName | ( | ) | const |
std::map< std::string, std::string > & pulsar::ReaderConfiguration::getProperties | ( | ) | const |
Get all the properties attached to this producer.
const std::string & pulsar::ReaderConfiguration::getProperty | ( | const std::string & | name | ) | const |
Get the value of a specific property
name | the name of the property |
ReaderListener pulsar::ReaderConfiguration::getReaderListener | ( | ) | const |
ReaderListener
for the reader const std::string & pulsar::ReaderConfiguration::getReaderName | ( | ) | const |
int pulsar::ReaderConfiguration::getReceiverQueueSize | ( | ) | const |
const SchemaInfo & pulsar::ReaderConfiguration::getSchema | ( | ) | const |
const std::string & pulsar::ReaderConfiguration::getSubscriptionRolePrefix | ( | ) | const |
long pulsar::ReaderConfiguration::getTickDurationInMs | ( | ) | const |
long pulsar::ReaderConfiguration::getUnAckedMessagesTimeoutMs | ( | ) | const |
bool pulsar::ReaderConfiguration::hasProperty | ( | const std::string & | name | ) | const |
Check whether the message has a specific property attached.
name | the name of the property to check |
bool pulsar::ReaderConfiguration::hasReaderListener | ( | ) | const |
ReaderListener
has been set bool pulsar::ReaderConfiguration::isEncryptionEnabled | ( | ) | const |
bool pulsar::ReaderConfiguration::isReadCompacted | ( | ) | const |
bool pulsar::ReaderConfiguration::isStartMessageIdInclusive | ( | ) | const |
The associated getter of setStartMessageIdInclusive
void pulsar::ReaderConfiguration::setAckGroupingMaxSize | ( | long | maxGroupingSize | ) |
Set max number of grouped messages within one grouping time window. If it's set to a non-positive value, number of grouped messages is not limited. Default is 1000.
maxGroupingSize | max number of grouped messages with in one grouping time window. |
void pulsar::ReaderConfiguration::setAckGroupingTimeMs | ( | long | ackGroupingMillis | ) |
Set time window in milliseconds for grouping message ACK requests. An ACK request is not sent to broker until the time window reaches its end, or the number of grouped messages reaches limit. Default is 100 milliseconds. If it's set to a non-positive value, ACK requests will be directly sent to broker without grouping.
ackGroupMillis | time of ACK grouping window in milliseconds. |
ReaderConfiguration & pulsar::ReaderConfiguration::setCryptoFailureAction | ( | ConsumerCryptoFailureAction | action | ) |
Set the CryptoFailureAction for the reader.
ReaderConfiguration & pulsar::ReaderConfiguration::setCryptoKeyReader | ( | CryptoKeyReaderPtr | cryptoKeyReader | ) |
Set the shared pointer to CryptoKeyReader.
the | shared pointer to CryptoKeyReader |
void pulsar::ReaderConfiguration::setInternalSubscriptionName | ( | std::string | internalSubscriptionName | ) |
Set the internal subscription name.
internal | subscriptionName Default value is reader-{random string}. |
ReaderConfiguration & pulsar::ReaderConfiguration::setProperties | ( | const std::map< std::string, std::string > & | properties | ) |
Add all the properties in the provided map
ReaderConfiguration & pulsar::ReaderConfiguration::setProperty | ( | const std::string & | name, |
const std::string & | value | ||
) |
Sets a new property on a message.
name | the name of the property |
value | the associated value |
void pulsar::ReaderConfiguration::setReadCompacted | ( | bool | compacted | ) |
If enabled, the consumer reads messages from the compacted topics rather than reading the full message backlog of the topic. This means that if the topic has been compacted, the consumer only sees the latest value for each key in the topic, up until the point in the topic message backlog that has been compacted. Beyond that point, message is sent as normal.
readCompacted can only be enabled subscriptions to persistent topics, which have a single active consumer (for example, failure or exclusive subscriptions). Attempting to enable it on subscriptions to a non-persistent topics or on a shared subscription leads to the subscription call failure.
readCompacted | whether to read from the compacted topic |
ReaderConfiguration & pulsar::ReaderConfiguration::setReaderListener | ( | ReaderListener | listener | ) |
A message listener enables your application to configure how to process messages. A listener will be called in order for every message received.
void pulsar::ReaderConfiguration::setReaderName | ( | const std::string & | readerName | ) |
Set the reader name.
readerName |
void pulsar::ReaderConfiguration::setReceiverQueueSize | ( | int | size | ) |
Sets the size of the reader 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 may potentially increase the consumer throughput at the expense of bigger memory utilization.
Setting the consumer queue size to 0 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 0. The receive() function call should not be interrupted when the consumer queue size is 0.
The default value is 1000 messages and it is appropriate for most use cases.
size | the new receiver queue size value |
ReaderConfiguration & pulsar::ReaderConfiguration::setSchema | ( | const SchemaInfo & | schemaInfo | ) |
Declare the schema of the data that this reader will be accepting.
The schema will be checked against the schema of the topic, and the reader creation will fail if it's not compatible.
schemaInfo | the schema definition object |
ReaderConfiguration & pulsar::ReaderConfiguration::setStartMessageIdInclusive | ( | bool | startMessageIdInclusive | ) |
Set the reader to include the startMessageId or given position of any reset operation like Reader::seek.
Default: false
startMessageIdInclusive | whether to include the reset position |
void pulsar::ReaderConfiguration::setSubscriptionRolePrefix | ( | const std::string & | subscriptionRolePrefix | ) |
Set the subscription role prefix.
The default prefix is an empty string.
subscriptionRolePrefix |
void pulsar::ReaderConfiguration::setTickDurationInMs | ( | const uint64_t | milliSeconds | ) |
Set the tick duration time that defines the granularity of the ack-timeout redelivery (in milliseconds).
The default value is 1000, which means 1 second.
Using a higher tick time reduces the memory overhead to track messages when the ack-timeout is set to a bigger value.
milliSeconds | the tick duration time (in milliseconds) |
void pulsar::ReaderConfiguration::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 |