Comments (8)
You should try the latest version, fromBeginning
is no longer support. If you want consume topic from the exact offset, you should set fromOffset
true and also set the offset in payload, for example:
var payloads = [{ topic: 't', partition: 0, offset: offset_you_want }];
var consumer = new Consumer( client, payloads, { fromOffset: true });
If you just want consume the current message, the default settings should satisfy you.
from kafka-node.
Using the default settings causes
this.consumer.on('message', function (message) {
console.log("Consumer Message",message);
});
to continuously output the first message once a message exists in the partition:
Consumer Message
{
topic: 'event-bus',
value: '{type:\'PageView\',body:[]}',
offset: 0,
partition: 0,
key: -1 }
from kafka-node.
Yes, what you see is the expected behavior of consumer with default settings. By default, consumer will consume message from the last commited offset when it start and consume whatever incoming message after start, it will automatically commit the offset too. If this not your use case, please explain here ^_^
from kafka-node.
I guess I was only expecting to consume each message once from the callback of Consumer.on, not have the last message consumed in a continuous loop. How can I block the consumption after one message until a new message is commited?
from kafka-node.
This seems a bug of consumer, I will look into it.
from kafka-node.
It should be fixed in this commit: fac599d
Please test it.
from kafka-node.
The !== undefined addition to lib/consumer.js fixed it! Thanks!
from kafka-node.
The !== undefined addition to lib/consumer.js fixed it! Thanks!
from kafka-node.
Related Issues (20)
- Request: upgrade dependency Snappy HOT 2
- Adding SASL users dynamically without cluster restart
- The "chunk" argument must be of type string or an instance of Buffer or Uint8Array HOT 1
- Need to Fix All vulnerabilities of Kafka-node HOT 2
- Make the error code be included in the error message.
- Need to resolve vulnerabilities on snappy.
- ConsumerGroup Noting to be commited
- Class extends value undefined is not a constructor or null HOT 1
- Help: Kafka topics are deleted automatically after sudo systemctl stop kafka is done. HOT 2
- High synk vulnerability.
- High synk vulnerability. Regular Expression Denial of Service HOT 1
- Producer is not sending message to new partitions added at runtime to a topic
- kafka-node with the Azure event hub connect string not working
- Getting Error "ECONNRESET at TLSWrap.onStreamRead" on producing message to event hub.
- kafka-node 支持定时检测连接情况并断线重连吗
- [Product Announcement] Introducing Kafka Sonar, the first Kafka Monitoring Tool on Docker Desktop
- kafka-code 支持只能被消费者组中的一个消费者消费吗?
- BrokerNotAvailableError: Broker not available (sendRequest -> ensureBrokerReady) HOT 1
- Does Kafka-node supports ECMA script or not
- Kafka-node 5.0.0 support highest kafka version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kafka-node.