0

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?

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
Boris K
  • 3,442
  • 9
  • 48
  • 87
  • What is `kafkaStreams.getKStream(null)`? What is `stream.writeToStream("my message")`? – Matthias J. Sax Oct 25 '18 at 22:51
  • I'm guessing that it is this that he means: https://github.com/nodefluent the question shouldn't be tagged with kafka-streams since they don't have much to do with each other. @Boris K what do you mean by subsequent streams? – Daniel Figueroa Oct 26 '18 at 23:55
  • @DanielFigueroa yes, exactly. What I mean is that all of the above stuff runs on a route in a server. The first request runs fine, and on subsequent requests, it hangs on ```await stream.start()``` – Boris K Oct 28 '18 at 08:41

0 Answers0