-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #915 from rabbitmq/backport-pr-910
Backport #910 to 6.x
- Loading branch information
Showing
9 changed files
with
103 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
using RabbitMQ.Client.Events; | ||
using System.Threading.Tasks; | ||
|
||
namespace RabbitMQ.Client.Impl | ||
{ | ||
sealed class BasicCancel : Work | ||
internal sealed class BasicCancel : Work | ||
{ | ||
readonly string _consumerTag; | ||
private readonly string _consumerTag; | ||
|
||
public override string Context => "HandleBasicCancel"; | ||
|
||
public BasicCancel(IBasicConsumer consumer, string consumerTag) : base(consumer) | ||
{ | ||
_consumerTag = consumerTag; | ||
} | ||
|
||
protected override async Task Execute(IModel model, IAsyncBasicConsumer consumer) | ||
protected override Task Execute(IAsyncBasicConsumer consumer) | ||
{ | ||
try | ||
{ | ||
await consumer.HandleBasicCancel(_consumerTag).ConfigureAwait(false); | ||
} | ||
catch (Exception e) | ||
{ | ||
if (!(model is ModelBase modelBase)) | ||
{ | ||
return; | ||
} | ||
|
||
var details = new Dictionary<string, object> | ||
{ | ||
{"consumer", consumer}, | ||
{"context", "HandleBasicCancel"} | ||
}; | ||
modelBase.OnCallbackException(CallbackExceptionEventArgs.Build(e, details)); | ||
} | ||
return consumer.HandleBasicCancel(_consumerTag); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
using RabbitMQ.Client.Events; | ||
using System.Threading.Tasks; | ||
|
||
namespace RabbitMQ.Client.Impl | ||
{ | ||
sealed class BasicCancelOk : Work | ||
internal sealed class BasicCancelOk : Work | ||
{ | ||
readonly string _consumerTag; | ||
private readonly string _consumerTag; | ||
|
||
public override string Context => "HandleBasicCancelOk"; | ||
|
||
public BasicCancelOk(IBasicConsumer consumer, string consumerTag) : base(consumer) | ||
{ | ||
_consumerTag = consumerTag; | ||
} | ||
|
||
protected override async Task Execute(IModel model, IAsyncBasicConsumer consumer) | ||
protected override Task Execute(IAsyncBasicConsumer consumer) | ||
{ | ||
try | ||
{ | ||
await consumer.HandleBasicCancelOk(_consumerTag).ConfigureAwait(false); | ||
} | ||
catch (Exception e) | ||
{ | ||
if (!(model is ModelBase modelBase)) | ||
{ | ||
return; | ||
} | ||
|
||
var details = new Dictionary<string, object>() | ||
{ | ||
{"consumer", consumer}, | ||
{"context", "HandleBasicCancelOk"} | ||
}; | ||
modelBase.OnCallbackException(CallbackExceptionEventArgs.Build(e, details)); | ||
} | ||
return consumer.HandleBasicCancelOk(_consumerTag); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
using RabbitMQ.Client.Events; | ||
using System.Threading.Tasks; | ||
|
||
namespace RabbitMQ.Client.Impl | ||
{ | ||
sealed class BasicConsumeOk : Work | ||
internal sealed class BasicConsumeOk : Work | ||
{ | ||
readonly string _consumerTag; | ||
private readonly string _consumerTag; | ||
|
||
public override string Context => "HandleBasicConsumeOk"; | ||
|
||
public BasicConsumeOk(IBasicConsumer consumer, string consumerTag) : base(consumer) | ||
{ | ||
_consumerTag = consumerTag; | ||
} | ||
|
||
protected override async Task Execute(IModel model, IAsyncBasicConsumer consumer) | ||
protected override Task Execute(IAsyncBasicConsumer consumer) | ||
{ | ||
try | ||
{ | ||
await consumer.HandleBasicConsumeOk(_consumerTag).ConfigureAwait(false); | ||
} | ||
catch (Exception e) | ||
{ | ||
if (!(model is ModelBase modelBase)) | ||
{ | ||
return; | ||
} | ||
|
||
var details = new Dictionary<string, object>() | ||
{ | ||
{"consumer", consumer}, | ||
{"context", "HandleBasicConsumeOk"} | ||
}; | ||
modelBase.OnCallbackException(CallbackExceptionEventArgs.Build(e, details)); | ||
} | ||
return consumer.HandleBasicConsumeOk(_consumerTag); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
using RabbitMQ.Client.Events; | ||
|
||
namespace RabbitMQ.Client.Impl | ||
{ | ||
sealed class ModelShutdown : Work | ||
internal sealed class ModelShutdown : Work | ||
{ | ||
readonly ShutdownEventArgs _reason; | ||
private readonly ShutdownEventArgs _reason; | ||
private readonly IModel _model; | ||
|
||
public override string Context => "HandleModelShutdown"; | ||
|
||
public ModelShutdown(IBasicConsumer consumer, ShutdownEventArgs reason) : base(consumer) | ||
public ModelShutdown(IBasicConsumer consumer, ShutdownEventArgs reason, IModel model) : base(consumer) | ||
{ | ||
_reason = reason; | ||
_model = model; | ||
} | ||
|
||
protected override async Task Execute(IModel model, IAsyncBasicConsumer consumer) | ||
protected override Task Execute(IAsyncBasicConsumer consumer) | ||
{ | ||
try | ||
{ | ||
await consumer.HandleModelShutdown(model, _reason).ConfigureAwait(false); | ||
} | ||
catch (Exception e) | ||
{ | ||
if (!(model is ModelBase modelBase)) | ||
{ | ||
return; | ||
} | ||
|
||
var details = new Dictionary<string, object>() | ||
{ | ||
{ "consumer", consumer }, | ||
{ "context", "HandleModelShutdown" } | ||
}; | ||
modelBase.OnCallbackException(CallbackExceptionEventArgs.Build(e, details)); | ||
} | ||
return consumer.HandleModelShutdown(_model, _reason); | ||
} | ||
} | ||
} |
Oops, something went wrong.