Loop Engine

Packages

@loop-engine/adapter-kafka

@loop-engine/adapter-kafka implements the runtime EventBus interface on top of a Kafka-like producer/consumer client.

Install

1npm install @loop-engine/adapter-kafka kafkajs

Event bus factory

1kafkaEventBus(options: {
2 kafka: KafkaLike
3 topic: string
4 groupId?: string
5}): EventBus
  • emit() sends serialized LoopEvent payloads to options.topic.
  • subscribe() starts a consumer with groupId (default: loopengine) and forwards parsed messages to the handler.
1import { Kafka } from "kafkajs"
2import { kafkaEventBus } from "@loop-engine/adapter-kafka"
3 
4const kafka = new Kafka({ brokers: ["localhost:9092"] })
5const bus = kafkaEventBus({ kafka, topic: "loop-events", groupId: "loopengine-docs" })

Topic strategy

Use one topic per environment or domain boundary to keep replay and retention policies explicit.