mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
				synced 2025-10-31 18:47:48 +00:00 
			
		
		
		
	Add MessageBuilder and use it on producer classes
This commit is contained in:
		| @@ -37,6 +37,7 @@ | ||||
| #include "topic.h" | ||||
| #include "partition.h" | ||||
| #include "macros.h" | ||||
| #include "message_builder.h" | ||||
|  | ||||
| namespace cppkafka { | ||||
|  | ||||
| @@ -72,10 +73,10 @@ class TopicConfiguration; | ||||
|  * string payload = "some payload"; | ||||
|  * | ||||
|  * // Write a message into an unassigned partition | ||||
|  * producer.produce(topic, Partition(), payload); | ||||
|  * producer.produce(MessageBuilder(topic).payload(payload)); | ||||
|  * | ||||
|  * // Write using a key on a fixed partition (42) | ||||
|  * producer.produce(topic, 42, key, payload); | ||||
|  * producer.produce(MessageBuilder(topic).partition(42).key(key).payload(payload)); | ||||
|  *  | ||||
|  * \endcode | ||||
|  */ | ||||
| @@ -112,30 +113,7 @@ public: | ||||
|      * \param partition The partition to write the message to | ||||
|      * \param payload The message payload | ||||
|      */ | ||||
|     void produce(const Topic& topic, const Partition& partition, const Buffer& payload); | ||||
|      | ||||
|     /** | ||||
|      * Produces a message | ||||
|      * | ||||
|      * \param topic The topic to write the message to | ||||
|      * \param partition The partition to write the message to | ||||
|      * \param key The message key | ||||
|      * \param payload The message payload | ||||
|      */ | ||||
|     void produce(const Topic& topic, const Partition& partition, const Buffer& key, | ||||
|                  const Buffer& payload); | ||||
|      | ||||
|     /** | ||||
|      * Produces a message | ||||
|      * | ||||
|      * \param topic The topic to write the message to | ||||
|      * \param partition The partition to write the message to | ||||
|      * \param key The message key | ||||
|      * \param payload The message payload | ||||
|      * \param user_data The opaque data pointer to be used (accesible via Message::private_data) | ||||
|      */ | ||||
|     void produce(const Topic& topic, const Partition& partition, const Buffer& key, | ||||
|                  const Buffer& payload, void* user_data); | ||||
|     void produce(const MessageBuilder& builder); | ||||
|  | ||||
|     /** | ||||
|      * \brief Polls on this handle | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matias Fontanini
					Matias Fontanini