diff --git a/pulsar-client-cpp/include/pulsar/ProducerConfiguration.h b/pulsar-client-cpp/include/pulsar/ProducerConfiguration.h index e260ca9c11e19..085d342d76316 100644 --- a/pulsar-client-cpp/include/pulsar/ProducerConfiguration.h +++ b/pulsar-client-cpp/include/pulsar/ProducerConfiguration.h @@ -85,7 +85,17 @@ class PULSAR_PUBLIC ProducerConfiguration { ProducerConfiguration(const ProducerConfiguration&); ProducerConfiguration& operator=(const ProducerConfiguration&); + /** + * Set the producer name which could be assigned by the system or specified by the client. + * + * @param producerName producer name. + * @return + */ ProducerConfiguration& setProducerName(const std::string& producerName); + + /** + * The getter associated with setProducerName(). + */ const std::string& getProducerName() const; /** @@ -124,7 +134,20 @@ class PULSAR_PUBLIC ProducerConfiguration { */ int getSendTimeout() const; + /** + * Set the baseline of the sequence ID for messages published by the producer. + *
+ * The first message uses (initialSequenceId + 1) as its sequence ID and subsequent messages are assigned + * incremental sequence IDs. + * + * @param initialSequenceId the initial sequence ID for the producer. + * @return + */ ProducerConfiguration& setInitialSequenceId(int64_t initialSequenceId); + + /** + * The getter associated with setInitialSequenceId(). + */ int64_t getInitialSequenceId() const; /** @@ -143,9 +166,26 @@ class PULSAR_PUBLIC ProducerConfiguration { * */ ProducerConfiguration& setCompressionType(CompressionType compressionType); + + /** + * The getter associated with setCompressionType(). + */ CompressionType getCompressionType() const; + /** + * Set the max size of the queue holding the messages pending to receive an acknowledgment from the + * broker.
When the queue is full, by default, all calls to Producer::send and Producer::sendAsync + * would fail unless blockIfQueueFull is set to true. Use {@link #setBlockIfQueueFull} to change the + * blocking behavior. + * + * @param maxPendingMessages max number of pending messages. + * @return + */ ProducerConfiguration& setMaxPendingMessages(int maxPendingMessages); + + /** + * The getter associated with setMaxPendingMessages(). + */ int getMaxPendingMessages() const; /** @@ -159,18 +199,57 @@ class PULSAR_PUBLIC ProducerConfiguration { ProducerConfiguration& setMaxPendingMessagesAcrossPartitions(int maxPendingMessagesAcrossPartitions); /** - * * @return the maximum number of pending messages allowed across all the partitions */ int getMaxPendingMessagesAcrossPartitions() const; + /** + * Set the message routing modes for partitioned topics. + * + * @param PartitionsRoutingMode partition routing mode. + * @return + */ ProducerConfiguration& setPartitionsRoutingMode(const PartitionsRoutingMode& mode); + + /** + * The getter associated with setPartitionsRoutingMode(). + */ PartitionsRoutingMode getPartitionsRoutingMode() const; + /** + * Set a custom message routing policy by passing an implementation of MessageRouter. + * + * @param messageRouter message router. + * @return + */ ProducerConfiguration& setMessageRouter(const MessageRoutingPolicyPtr& router); + + /** + * The getter associated with setMessageRouter(). + */ const MessageRoutingPolicyPtr& getMessageRouterPtr() const; + /** + * Set the hashing scheme, which is a standard hashing function available when choosing the partition + * used for a particular message. + * + *
Standard hashing functions available are: + *
All messages in a batch are published as a single batch message. + * The consumer is delivered individual + * messages in the batch in the same order they are enqueued. + * + * @param batchingMaxAllowedSizeInBytes + */ ProducerConfiguration& setBatchingMaxAllowedSizeInBytes( const unsigned long& batchingMaxAllowedSizeInBytes); + + /** + * The getter associated with setBatchingMaxAllowedSizeInBytes(). + */ const unsigned long& getBatchingMaxAllowedSizeInBytes() const; + /** + * Set the max time for message publish delay permitted in a batch. + * Default value: 10 ms. + * + * @param batchingMaxPublishDelayMs max time for message publish delay permitted in a batch. + * @return + */ ProducerConfiguration& setBatchingMaxPublishDelayMs(const unsigned long& batchingMaxPublishDelayMs); + + /** + * The getter associated with setBatchingMaxPublishDelayMs(). + */ const unsigned long& getBatchingMaxPublishDelayMs() const; /** * @see BatchingType */ ProducerConfiguration& setBatchingType(BatchingType batchingType); + + /** + * @return batching type. + * @see BatchingType. + */ BatchingType getBatchingType() const; + /** + * The getter associated with setCryptoKeyReader(). + */ const CryptoKeyReaderPtr getCryptoKeyReader() const; + + /** + * Set the shared pointer to CryptoKeyReader. + * + * @param shared pointer to CryptoKeyReader. + * @return + */ ProducerConfiguration& setCryptoKeyReader(CryptoKeyReaderPtr cryptoKeyReader); + /** + * The getter associated with setCryptoFailureAction(). + */ ProducerCryptoFailureAction getCryptoFailureAction() const; + + /** + * Sets the ProducerCryptoFailureAction to the value specified. + * + * @param action + * the action taken by the producer in case of encryption failures. + * @return + */ ProducerConfiguration& setCryptoFailureAction(ProducerCryptoFailureAction action); /**