pulsar-client-cpp
Public Types | Public Member Functions | Friends | List of all members
pulsar::ProducerConfiguration Class Reference

#include <ProducerConfiguration.h>

Public Types

enum  PartitionsRoutingMode { UseSinglePartition, RoundRobinDistribution, CustomPartition }
 
enum  HashingScheme { Murmur3_32Hash, BoostHash, JavaStringHash }
 

Public Member Functions

 ProducerConfiguration (const ProducerConfiguration &)
 
ProducerConfiguration & operator= (const ProducerConfiguration &)
 
ProducerConfiguration & setProducerName (const std::string &producerName)
 
const std::string & getProducerName () const
 
ProducerConfiguration & setSchema (const SchemaInfo &schemaInfo)
 
const SchemaInfo & getSchema () const
 
ProducerConfiguration & setSendTimeout (int sendTimeoutMs)
 
int getSendTimeout () const
 
ProducerConfiguration & setInitialSequenceId (int64_t initialSequenceId)
 
int64_t getInitialSequenceId () const
 
ProducerConfiguration & setCompressionType (CompressionType compressionType)
 
CompressionType getCompressionType () const
 
ProducerConfiguration & setMaxPendingMessages (int maxPendingMessages)
 
int getMaxPendingMessages () const
 
ProducerConfiguration & setMaxPendingMessagesAcrossPartitions (int maxPendingMessagesAcrossPartitions)
 
int getMaxPendingMessagesAcrossPartitions () const
 
ProducerConfiguration & setPartitionsRoutingMode (const PartitionsRoutingMode &mode)
 
PartitionsRoutingMode getPartitionsRoutingMode () const
 
ProducerConfiguration & setMessageRouter (const MessageRoutingPolicyPtr &router)
 
const MessageRoutingPolicyPtr & getMessageRouterPtr () const
 
ProducerConfiguration & setHashingScheme (const HashingScheme &scheme)
 
HashingScheme getHashingScheme () const
 
ProducerConfiguration & setBlockIfQueueFull (bool)
 
bool getBlockIfQueueFull () const
 
ProducerConfiguration & setBatchingEnabled (const bool &batchingEnabled)
 
const bool & getBatchingEnabled () const
 
ProducerConfiguration & setBatchingMaxMessages (const unsigned int &batchingMaxMessages)
 
const unsigned int & getBatchingMaxMessages () const
 
ProducerConfiguration & setBatchingMaxAllowedSizeInBytes (const unsigned long &batchingMaxAllowedSizeInBytes)
 
const unsigned long & getBatchingMaxAllowedSizeInBytes () const
 
ProducerConfiguration & setBatchingMaxPublishDelayMs (const unsigned long &batchingMaxPublishDelayMs)
 
const unsigned long & getBatchingMaxPublishDelayMs () const
 
const CryptoKeyReaderPtr getCryptoKeyReader () const
 
ProducerConfiguration & setCryptoKeyReader (CryptoKeyReaderPtr cryptoKeyReader)
 
ProducerCryptoFailureAction getCryptoFailureAction () const
 
ProducerConfiguration & setCryptoFailureAction (ProducerCryptoFailureAction action)
 
std::set< std::string > & getEncryptionKeys ()
 
bool isEncryptionEnabled () const
 
ProducerConfiguration & addEncryptionKey (std::string key)
 
bool hasProperty (const std::string &name) const
 
const std::string & getProperty (const std::string &name) const
 
std::map< std::string, std::string > & getProperties () const
 
ProducerConfiguration & setProperty (const std::string &name, const std::string &value)
 
ProducerConfiguration & setProperties (const std::map< std::string, std::string > &properties)
 

Friends

class PulsarWrapper
 

Detailed Description

Class that holds the configuration for a producer

Member Function Documentation

◆ getMaxPendingMessagesAcrossPartitions()

int pulsar::ProducerConfiguration::getMaxPendingMessagesAcrossPartitions ( ) const
Returns
the maximum number of pending messages allowed across all the partitions

◆ getProperties()

std::map<std::string, std::string>& pulsar::ProducerConfiguration::getProperties ( ) const

Get all the properties attached to this producer.

◆ getProperty()

const std::string& pulsar::ProducerConfiguration::getProperty ( const std::string &  name) const

Get the value of a specific property

Parameters
namethe name of the property
Returns
the value of the property or null if the property was not defined

◆ getSchema()

const SchemaInfo& pulsar::ProducerConfiguration::getSchema ( ) const
Returns
the schema information declared for this producer

◆ hasProperty()

bool pulsar::ProducerConfiguration::hasProperty ( const std::string &  name) const

Check whether the producer has a specific property attached.

Parameters
namethe name of the property to check
Returns
true if the message has the specified property
false if the property is not defined

◆ setCompressionType()

ProducerConfiguration& pulsar::ProducerConfiguration::setCompressionType ( CompressionType  compressionType)

Set the compression type for the producer.

By default, message payloads are not compressed. Supported compression types are:

◆ setMaxPendingMessagesAcrossPartitions()

ProducerConfiguration& pulsar::ProducerConfiguration::setMaxPendingMessagesAcrossPartitions ( int  maxPendingMessagesAcrossPartitions)

Set the number of max pending messages across all the partitions

This setting will be used to lower the max pending messages for each partition (setMaxPendingMessages(int)), if the total exceeds the configured value.

Parameters
maxPendingMessagesAcrossPartitions

◆ setProperties()

ProducerConfiguration& pulsar::ProducerConfiguration::setProperties ( const std::map< std::string, std::string > &  properties)

Add all the properties in the provided map

◆ setProperty()

ProducerConfiguration& pulsar::ProducerConfiguration::setProperty ( const std::string &  name,
const std::string &  value 
)

Sets a new property on the producer

Parameters
namethe name of the property
valuethe associated value

◆ setSchema()

ProducerConfiguration& pulsar::ProducerConfiguration::setSchema ( const SchemaInfo &  schemaInfo)

Declare the schema of the data that will be published by this producer.

The schema will be checked against the schema of the topic, and it will fail if it's not compatible, though the client library will not perform any validation that the actual message payload are conforming to the specified schema.

For all purposes, this

Parameters
schemaInfo
Returns

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