From 04e0b6953f52346da367754420fdb2710da26add Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Mon, 5 May 2025 11:54:40 +0100 Subject: [PATCH] Enable chunking by default in producer --- trustgraph-base/trustgraph/base/producer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/trustgraph-base/trustgraph/base/producer.py b/trustgraph-base/trustgraph/base/producer.py index bb665924..550855b8 100644 --- a/trustgraph-base/trustgraph/base/producer.py +++ b/trustgraph-base/trustgraph/base/producer.py @@ -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: