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

Falsy ack after reconnect? #362

Open
thomasvargiu opened this issue Nov 7, 2023 · 1 comment
Open

Falsy ack after reconnect? #362

thomasvargiu opened this issue Nov 7, 2023 · 1 comment

Comments

@thomasvargiu
Copy link

thomasvargiu commented Nov 7, 2023

I was looking at the code and I see:

    /** Send an `ack` to the underlying channel. */
    ack(message: amqplib.Message, allUpTo?: boolean): void {
        this._channel && this._channel.ack(message, allUpTo);
    }

I see that under reconnection  _channel  is undefined.

Imagine that we get 1000 messages from the server and we want to consume them sequentially in a stream:

message<1>.ack() // OK
...reconnection
message<2>.ack() // FALSY OK, no channel set, ignored call to `_channel.ack`
message<3>.ack() // FALSY OK
...connected // Consumer restart
message<2>.ack() // OK

Any message during reconnection will be falsy acked and we can't known when we can stop the stream.

Am I wrong?

@thomasvargiu
Copy link
Author

thomasvargiu commented Nov 7, 2023

I think it's possibile to mitigate it listening to the ConnectionManager disconnect event, but there is no event about every time the channel closed. Ok, I know if the connection is still up and the channel closes, opening a new one is very fast and we can attach to Channel connect event, but it is emitted after the setup.

We should have the possibility to control the consuming flow. Probably a new event on every close can help to mitigate my situation.

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

1 participant