-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
commit offset manually when using consumer group #1570
Comments
Whilst #1164 did (fairly recently) add support for setting It seems this could be achieved be extracted the commit parts of |
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. |
I also encounter this issue, when it will be fixed? |
After reading #1158 I noticed that the PR #1164 didn't even intend to address the manual commit. The author of the PR just wanted to disable the commit-by-interval so it fits for his specific use case of the PartitionOffsetManager. The interval timer isn't even turned off when Enable=false. #1678 and #1687 don't address the manual commit either. The PR partially reverts the #1164 (so the commit is by the interval again?), and notify the offset to the consumer group over a async channel. |
Please see new attempt at #1699 |
As there's been a lot of interest in this functionality, it would be great if all the people watching this issue could test out the now merged PR from @wclaeys with their application code in advance of us cutting any new release version. Assuming you're using go modules to manage your dependencies, you can update your go.mod to fetch the latest commit from the default branch by doing:
|
Looks like Sarama version 1.26.4 still does not support manual commit, neither flushes to broker after a certain amount of time if Auto Commit is false. I am correct? My case scenario keeps reading old messages if I restart my app when AutoCommit=false, even is I do: When is this going to be fixed? Or, how can I at least manually flush to broker? |
@danieldestro as mentioned in the comment immediately above yours, this functionality is available on the master branch. Despite a lot of interest in this functionality we haven’t yet had any feedback on whether or not the merged PR has been tested and satisfies people’s requirements or not. We can cut a new release tag as soon as we’ve had that confirmation. Can you test out @Head? |
I have just tested Sarama version currently on master regarding the use off But I have a couple of questions here. Firstly, I thought that when AutoCommit is false, I had to call Then, I implemented the following code, expecting to commit only the offsets marked with
Well, let me go back a little bit. I ran a different scenario now. Last message sent/read was a message where the But, if continue my test and produce/read more messages and new messages are marked as read and Commit is called, if I stop the consumer app and re-run it, old ERROR messages (not marked) will not be read again. Why? Is it because when Commit is called upon, Kafka remembers the last commited offset to that particular consumer group? What I need is: mark success messages as read and the messages with error I want them to not be marked as read, to be able to process them again later. Is this scenario possible with Kafka + Sarama? Or should I think in something else like using a DLQ to handle messages with error to be reprocessed later? |
My third test:
Even if there is a message with error (returned by Well, I confess I am kind confused here about what should be the expected behavior when using AutoCommit=false and calling MarkMessage and Commit methods. And the correct implementation for the expected behavior. |
|
@dnwe We have it running on our DEV and TEST environments since the 24th of June without any issues (actually even before that date when we were running on a private fork). |
Thanks, @wclaeys - so what is the scenario and expected results you get from setting AutoCommit=false and calling Commit? So I can understand better how this patch works. |
I also got confused, so i ran the following tests:
Please clear the confusion for #test2. |
@danieldestro I could not reproduce the issue you are reporting here. #1570 (comment)
|
@alok87 as far as I remember, in my tests this scenario occurred: Test-1:
Test-2:
Test-3:
|
Is their any programmatic way or kafka config to reprocess consume but Not committed and Not MarkMessage events at run time without restarting application; Or it reassign to other member of that consumer group. |
Test1 is failing for me #1570 (comment) |
@danieldestro I think the behaviour you saw with second last message here (Test 3) #1570 (comment) was because the last commit got committed so the new consumption will only begin from the last cosumed offset + 1 which is what is happening in your case. The 2nd last errored one which was not marked would get ignored. |
ConsumeClaim will be called after each kafka consume group rebalance. So your commitMessages goroutine will be called many times. It may be not good. |
Versions
Please specify real version numbers or git SHAs, not just "Latest" since that changes fairly regularly.
sarama version : Version 1.25.0
go version : go1.12.7
Kafka version: 2.2.1
My use case is: I am reading from a topic, so in case my my consumer fails I should be able to read from my last successful commit rather, If I set in time interval there is chance of message loss. I want to commit manually while using consumer group, I don't want to commit in intervals.
I went through offset_manager.go, but I am unable to do. Kindly help.
The text was updated successfully, but these errors were encountered: