Node Kafka Streams hangs after first connection

205 views Asked by At

I have an HTTP2 application which creates a new Kafka streams producer and sends messages to it on receiving a message from an incoming stream.

The first time it connects and functions properly. On subsequent streams, it fails without throwing any sort of error.

This is how I'm doing it:

"use strict";

const {KafkaStreams} = require('kafka-streams');
const {nativeConfig: config} = require("./kafka-config.js");

const kafkaStreams = new KafkaStreams(config);
const stream = kafkaStreams.getKStream(null);

...stream stuff...
stream.to("test-topic");

await stream.start()

await stream.writeToStream("my message");

await setTimeout(kafkaStreams.closeAll.bind(kafkaStreams), 100););

Does anyone have any ideas of what could be wrong?

0

There are 0 answers