microsoft / kafka-proxy-ws

A robust, scalable, high performance WebSockets based proxy for Kafka.
143 stars 37 forks source link

client getting same message always #4

Open Bichitra73 opened 6 years ago

Bichitra73 commented 6 years ago

My producer is .net desktop application and sending message infinite loop without delay. 100 updated records if i use directly no-kafka i am getting all messages but i am getting single last updated message always using proxy the below code did I do any wrong or missing?

I created server just like sample example.

let kafkaProxy = new KafkaProxy({ wsPort: 5000, // required kafka: 'localhost:9092/', // required idleTimeout: 200, // time to wait between batches maxBytes: 1000000, // the max size of a batch to be downloaded partition: 1, // the default partition to listen to

});

kafkaProxy.listen(); console.log("socket created");

consumer const WebSocket = require('ws') const server = 'ws://localhost:9999/';

var ws = {}; ws['test'] = new WebSocket('ws://localhost:5000/?topic=test&consumerGroup=no-kafka-group-v0.9&offset=0');

ws['test'].onmessage = (evt, flags) => { let batch = JSON.parse(evt.data); console.log (batch[batch.length-1].message); // console.log('Received a batch of messages from kafka. Size:'); };