pulsar-client-cpp
Public Member Functions | List of all members
pulsar::ReaderConfiguration Class Reference

#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
 

Detailed Description

Class specifying the configuration of a consumer.

Member Function Documentation

◆ getSchema()

const SchemaInfo& pulsar::ReaderConfiguration::getSchema ( ) const
Returns
the schema information declared for this consumer

◆ setReaderListener()

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.

◆ setReceiverQueueSize()

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 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.

Parameters
sizethe new receiver queue size value

◆ setSchema()

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.

Parameters
schemaInfothe schema definition object

The documentation for this class was generated from the following file: