controlador de kafka
Engineered with formal verification principles, strict type validation, and native production readiness.
Minimalistic and clean message handling.
Fully typed, PEP 8 compliant, supporting Python 3.9 through 3.14.
Built-in support for SASL (PLAIN, SCRAM) and KRaft mode.
Seamlessly send and receive images (OpenCV/NumPy/PIL) and arbitrary files (PDF, ZIP, TXT) via `format="file"`.
Automatic schema validation with `format="pydantic"`.
Control At-Least-Once delivery semantics with `auto_commit=False` and `msg.commit()`.
Designed to eliminate low-level plumbing and cognitive friction, allowing engineers to build reliable solutions in minutes.
from wkafka import WKafka
# Configures automatically via KAFKA_SERVER or defaults to localhost:9092
kafka = WKafka(bootstrap_servers="localhost:9092")
@kafka.consumer(topic="orders", format="json")
def handle_order(msg):
print(f"New order received: {msg.value}")
# Start consumers in a background thread pool
kafka.run_consumers(block=True)
# Produce with context manager safety
with kafka.producer() as p:
p.send("orders", value={"id": 123, "item": "Coffee"}, format="json")
wkafka is an integral component within the Wisrovi Binary Universe, engineered by William Steve Rodriguez Villamizar to unify high-throughput distributed systems, formal verification, and autonomous agent orchestration.