Skip to content
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

Question - Purging and adding topics results in redelivery of old messages despite last offset #727

Closed
StarpTech opened this issue May 10, 2024 · 2 comments

Comments

@StarpTech
Copy link

Hi, we use AddConsumeTopics(foo) to add new topics to the client dynamically. This works great. Unfortunately, we experienced redelivering of old messages once PurgeTopicsFromConsuming(foo) has been called after AddConsumeTopics(foo). It seems that the client forget that we have set the offset to kgo.ConsumeResetOffset(kgo.NewOffset().AfterMilli(time.Now().UnixMilli())). Is this expected? I believe it is because PurgeTopicsFromConsuming(foo) will also remove the offset state.

We were able to workaround this by using PauseFetchTopics and ResumeFetchTopics

@twmb
Copy link
Owner

twmb commented May 23, 2024

I'm a bit confused here -- when you say "It seems that the client forget that we have set the offset to ... time.Now()", doesn't that mean that the time.Now is set once, and then any time you purge and re-add the topic, re-adding it will re-consume from the original offset milli.

What is your expected goal? Purging does remove literally everything about the state of a topic within the client. What is not removed is any initial configuration -- initial configuration is used when re-adding the topic.

If you intend to pause consuming and then resume later, PauseFetchTopics and ResumeFetchTopics are the two correct APIs to use.

I'm going to pre-emptively close this issue hoping my message answers your question, but please reply if it did not.

@twmb twmb closed this as completed May 23, 2024
@StarpTech
Copy link
Author

I'm a bit confused here -- when you say "It seems that the client forget that we have set the offset to ... time.Now()", doesn't that mean that the time.Now is set once, and then any time you purge and re-add the topic, re-adding it will re-consume from the original offset milli.

Exactly, that's the conclusion I came to as well. It was not obvious to me because I created the client once with the offset config. Thanks for confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants