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

Resend after reconnection cause reproduce of the same msg #731

Open
WinChua opened this issue Feb 20, 2022 · 1 comment · May be fixed by #732
Open

Resend after reconnection cause reproduce of the same msg #731

WinChua opened this issue Feb 20, 2022 · 1 comment · May be fixed by #732

Comments

@WinChua
Copy link

WinChua commented Feb 20, 2022

After the reconnection of the producer, the msg in the pendingQueue will be resend.
But not every msg in pendingQueue hasn't send to broker, the resend logic here seems to deal with the problem that producer meet a network error when producing a msg which cause the msg doesn't really send to broker.

While, the code here

p.log.Warnf("Received ack for %v on sequenceId %v - expected: %v, closing connection", response.GetMessageId(),

will also trigger the reconnection logic again and again, as well as the resend logic, which cause the consumer to consume the same msg with difference msgId

@WinChua
Copy link
Author

WinChua commented Feb 21, 2022

Try to present a solution, the problem is that in the resend logic after the reconnection of producer, no mater the item in pendingQueue has been sent or not, all the items will be resend to broker, which will cause the redundancy of msg.
We can add sent flag in pendingItemQueue initialized as false, which will be set to true after the corresponding buffer has been sent successfully.
And filter the items which has been sent after the reconnection, resend the item which has not been sent only.

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