Enable chunking by default in producer

This commit is contained in:
Cyber MacGeddon 2025-05-05 11:54:40 +01:00
parent 844547ab5f
commit 04e0b6953f

View file

@ -4,7 +4,9 @@ import asyncio
class Producer:
def __init__(self, client, topic, schema, metrics=None):
def __init__(self, client, topic, schema, metrics=None,
chunking_enabled=True):
self.client = client
self.topic = topic
self.schema = schema
@ -14,6 +16,8 @@ class Producer:
self.running = True
self.producer = None
self.chunking_enabled = chunking_enabled
def __del__(self):
self.running = False
@ -38,7 +42,8 @@ class Producer:
print("Connect publisher to", self.topic, "...", flush=True)
self.producer = self.client.create_producer(
topic = self.topic,
schema = JsonSchema(self.schema)
schema = JsonSchema(self.schema),
chunking_enabled = self.chunking_enabled,
)
print("Connected to", self.topic, flush=True)
except Exception as e: