mirror of
https://github.com/20kaushik02/real-time-traffic-analysis-clickhouse.git
synced 2026-01-25 08:04:04 +00:00
remove intermdiate json
This commit is contained in:
@@ -18,7 +18,8 @@ KAFKA_SERVER = 'localhost:9092' # Adjust to your Kafka server
|
||||
# Initialize Kafka Producer
|
||||
producer = KafkaProducer(
|
||||
bootstrap_servers=KAFKA_SERVER,
|
||||
value_serializer=lambda v: json.dumps(v).encode('utf-8') # Encode data as JSON
|
||||
#value_serializer=lambda v: json.dumps(v).encode('utf-8') # Encode data as JSON
|
||||
value_serializer=lambda v: v.encode('utf-8') if isinstance(v, str) else str(v).encode('utf-8') #remove intermediate JSON encoding
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user