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

ModelBase.WaitForConfirmsOrDieAsync uses ShutdownInitiator.Application rather than Library #1039

Closed
StevenBonePgh opened this issue Apr 22, 2021 · 1 comment
Milestone

Comments

@StevenBonePgh
Copy link
Contributor

I am using logic similar to that mentioned in #159 to recover connections, and it has worked great except for a recent case. The logic is:

model.ModelShutdown += (sender, args) =>
{
    if (args.Initiator == ShutdownInitiator.Application)
        return; //We closed it, do not attempt to recover.
    // Library/Peer closed it so recover. [Code snipped]
}; 

However, the code in ModelBase.WaitForConfirmsOrDieAsync does this:

public async Task WaitForConfirmsOrDieAsync(CancellationToken token = default)
{
try
{
bool onlyAcksReceived = await WaitForConfirmsAsync(token).ConfigureAwait(false);
if (onlyAcksReceived)
{
return;
}
await CloseAsync(
new ShutdownEventArgs(ShutdownInitiator.Application, Constants.ReplySuccess, "Nacks Received",
new IOException("nack received")),
false).ConfigureAwait(false);
}
catch (TaskCanceledException exception)
{
await CloseAsync(new ShutdownEventArgs(ShutdownInitiator.Application,
Constants.ReplySuccess,
"Timed out waiting for acks",
exception),
false).ConfigureAwait(false);
}
}

Since it is using ShutdownInitiator.Application, my autorecovery code does not fire. I would expect the RabbitMq Client to use ShutdownInitiator.Library in this case. Is this a bug, or should I handle things differently?

@michaelklishin
Copy link
Member

I doubt this was an intentional decision. Please submit a PR.

michaelklishin added a commit that referenced this issue Apr 22, 2021
Resolve #1039 Confirms Failure should use ShutdownInitiator.Library
michaelklishin added a commit that referenced this issue Apr 22, 2021
Resolve #1039 Confirms Failure should use ShutdownInitiator.Library

(cherry picked from commit 7557d0c)

Conflicts:
	projects/RabbitMQ.Client/client/impl/ModelBase.cs
@michaelklishin michaelklishin added this to the 6.2.2 milestone Apr 22, 2021
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