Simple Kafka stack to facilitate the local development of Consumers
docker run -tid \
-e 'HKPS_BROKERS=localhost:9092' \
-v $(pwd)/examples:/data \
hitmands/kafka-producer-stub:latest
HKPS_
prefix is used to namespace variables
HKPS_BROKERS='localhost:9092'
- You can look at our example
// messages-provider.mjs
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const messages = ["Hello World", "Hello Galaxy", "Hello Universe"];
export async function* messenger() {
while (messages.length) {
await sleep(1000);
const message = Buffer.from(messages.shift());
// optional
const options = { partition: null, key: null, ts: Date.now() };
yield { topic: "stub-topic", message, options };
}
}
curl -sSL https://raw.githubusercontent.com/hitmands/kafka-producer-stub/main/docker-compose.yml > docker-compose.yml
docker-compose up -d