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

Each message will be consumed twice.[Bug] #2066

Closed
1 of 2 tasks
mrcat2018 opened this issue Dec 28, 2021 · 0 comments · Fixed by #2067
Closed
1 of 2 tasks

Each message will be consumed twice.[Bug] #2066

mrcat2018 opened this issue Dec 28, 2021 · 0 comments · Fixed by #2067
Assignees
Labels
type/bug Something is wrong
Milestone

Comments

@mrcat2018
Copy link

What happened

Anytime it happens.

What you expected to happen

The confirmed message should not be consumed again.

How to reproduce

func main() {
cfg, err := config.ParseAddress("xxx")
if err != nil {
log.Errorf("Failed to parse address", err.Error())
panic(err)
}
c, err := client.NewConsumer(cfg)
if err != nil {
log.Errorf("new consumer error %s", err.Error())
panic(err)
}
start := time.Now()
for {
elapsed := time.Since(start)
if elapsed >= 10*time.Minute {
break
}
log.Debug("before GetMessage ")
crmsg, err := c.GetMessage()
if err != nil {
log.Errorf("Get message error %s", err.Error())
continue
}
cr, err := c.Confirm(crmsg.ConfirmContext, true)
if err != nil {
log.Errorf("Confirm error %s", err.Error())
continue
}
log.Debug(cr)
consume(context.Background(), crmsg)
}
c.Close()
}

Environment

centos7

InLong version

master

InLong Component

InLong TubeMQ

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants