From b447689d2b36dd76c7210219a87726bfa3e65440 Mon Sep 17 00:00:00 2001 From: Chris Snow Date: Mon, 9 Dec 2024 08:48:42 +0000 Subject: [PATCH] Update documentation --- _sources/vast_datastore/kafka_connect.md | 5 ++++- vast_datastore/kafka_connect.html | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/_sources/vast_datastore/kafka_connect.md b/_sources/vast_datastore/kafka_connect.md index 8e93ff88..921a2a75 100644 --- a/_sources/vast_datastore/kafka_connect.md +++ b/_sources/vast_datastore/kafka_connect.md @@ -179,11 +179,14 @@ finally: ```python from kafka import KafkaProducer import json + num_of_messages = # Complete - the amount of messages to topic (can be also 1) data = {"name": "something"} producer = KafkaProducer(bootstrap_servers=':9092', value_serializer=lambda v: json.dumps(v).encode('utf-8')) + for i in range (1,num_of_messages): - producer.send('', data) + producer.send('', data) + producer.flush() print("Message sent to Kafka topic") diff --git a/vast_datastore/kafka_connect.html b/vast_datastore/kafka_connect.html index c5a1a097..75f62702 100644 --- a/vast_datastore/kafka_connect.html +++ b/vast_datastore/kafka_connect.html @@ -695,11 +695,14 @@

Creating new topic#

from kafka import KafkaProducer  
 import json  
+
 num_of_messages = # Complete - the amount of messages to topic (can be also 1)  
 data = {"name": "something"}  
 producer = KafkaProducer(bootstrap_servers='<YOUR_CLIENT_IP>:9092', value_serializer=lambda v: json.dumps(v).encode('utf-8'))  
+
 for i in range (1,num_of_messages):  
-    producer.send('<YOUR_TOPIC_NAME>', data)  
+    producer.send('<YOUR_TOPIC_NAME>', data)
+    
 producer.flush()
 
 print("Message sent to Kafka topic")