'How can i realize http-streaming of kafka messages to endpoint on Nodejs?
I've been trying to realize stream kafka messages by get endpoint on client side using http-streaming. Thats my kafka consumer, where i recieve messages from producer
var consumer = new Kafka.KafkaConsumer({
'group.id': 'kafka',
'metadata.broker.list': 'localhost:9092',
}, {});
consumer.connect();
consumer.on('ready', () => {
console.log('consumer ready..')
consumer.subscribe(['test']);
consumer.consume();
}).on('data', function(data) {
console.log(`received message: ${eventType.fromBuffer(data.value)}`);
});
I need to stream this messages by endpoint. How can i do that? I tryed do that on Koa and express, I just put this code into get endpoint
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|