https://github.com/PostHog/posthog/pull/3280
ee/kafka_client/client.py
import json
from typing import Any, Callable, Dict, Optional
import kafka.errors
from kafka import KafkaConsumer as KC
from kafka import KafkaProducer as KP
from structlog import get_logger
from ee.kafka_client import helper
from ee.settings import KAFKA_ENABLED
from posthog.client import async_execute, sync_execute
from posthog.settings import KAFKA_BASE64_KEYS, KAFKA_HOSTS, TEST
from posthog.utils import SingletonDecorator
KAFKA_PRODUCER_RETRIES = 5
logger = get_logger(__file__)
class TestKafkaProducer:
    def __init__(self):
        pass
    def send(self, topic: str, value: Any, key: Any = None):
        return
    def flush(self):
        return
class TestKafkaConsumer:
    def __init__(self, topic="test", max=0, **kwargs):