-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autocommit offset does not work if i use high level api #480
Comments
Are you calling consumer_close() before exiting? Can you reproduce this with examples/rdkafka_consumer_example ? |
i don't call the consumer_close(),the offset record by consumer_close()? |
You need to call consume_close() to properly shut down your consumer and let it perform final offset commits, group leaves, etc. |
Have api to record offset by myself? |
You may commit offsets yourself with |
can't auto commit? |
auto commit is enabled by default, but you must call consumer_close() before exiting. |
I think this is not good,if my program crash the offset will not commit. |
If auto commit is enabled ( When exiting an application must also call consumer_close() to commit any offsets waiting to be committed from the last interval. This is a pay off between performance and consistency. |
I set 'enable.auto.commit=true' and 'auto.commit.interval.ms', but can't periodically committed. |
What do you set ..interval.ms to? |
mee too |
auto.commit.interval.ms=4000 |
Run your program with Also, what is the reason for not calling consumer_close()? |
RDKAFKA-7-TOPIC: rdkafka#consumer-0: New local topic: test1 RDKAFKA-7-PARTCNT: rdkafka#consumer-0: Topic test1 partition count changed from |
This offset looks very weird: Can you show me your code that calls rd_kafka_subscribe()? |
rebalance_cb is your example's code. |
Code looks good. Can you reproduce this behaviour with examples/rdkafka_consumer_example? |
I just use examples/rdkafka_consumer_example, but can't auto commit offset:
|
I run rdkafka_performance to produce message and rdkafka_consumer_example to consume message,the auto commit doesn't work. |
One unrelated note: in balanced consumer group mode a consumer can only subscribe on topics, not topics:partitions, this means that the partitions you specify on the command line are ignored. |
I've pushed a number of fixes around offset handling, could you update to latest master and see if you can still reproduce the issue? |
I update last version, but but can't auto commit offset. |
I found the reason.
|
@ago3x Good find, thanks! |
@ago3x I call rd_kafka_conf_set, but can't auto commit offset. |
@DavidLiuXh rdkafka_conf.c:403 |
Or simply update to latest master |
Can you confirm that this fixes the issue? |
@edenhill |
👍 |
@edenhill i updated to latest master and run the rdkafka_consumer_example,it will core dumped soon. |
This looks similar to issue #493 |
it will not happen when i disable the autocommit. |
I use the high level api(rd_kafka_subscribe and rd_kafka_consumer_poll) to consume messages,but when i restart the programe it will consume the message from offset 0.
The text was updated successfully, but these errors were encountered: