Skip to content

Commit

Permalink
Merge branch 'release/2.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
MvRens committed Sep 5, 2021
2 parents 574a1fd + 66a0ec1 commit 447e354
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Tapeti.Cmd/ConsoleHelper/ConsoleWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public virtual void Dispose()
public void Confirm(string message)
{
WriteLine(message);
TryReadKey(false, out var _);
TryReadKey(false, out _);
}


Expand Down
3 changes: 1 addition & 2 deletions Tapeti.Cmd/Verbs/PurgeVerb.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using CommandLine;
using CommandLine;
using RabbitMQ.Client;
using Tapeti.Cmd.ConsoleHelper;

Expand Down
3 changes: 1 addition & 2 deletions Tapeti.Cmd/Verbs/RemoveQueueVerb.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using CommandLine;
using CommandLine;
using RabbitMQ.Client;
using RabbitMQ.Client.Exceptions;
using Tapeti.Cmd.ConsoleHelper;
Expand Down
2 changes: 1 addition & 1 deletion Tapeti.Flow/Default/FlowStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public CachedFlowState(FlowState flowState, bool isPersistent)
private readonly ConcurrentDictionary<Guid, CachedFlowState> flowStates = new ConcurrentDictionary<Guid, CachedFlowState>();
private readonly ConcurrentDictionary<Guid, Guid> continuationLookup = new ConcurrentDictionary<Guid, Guid>();
private readonly LockCollection<Guid> locks = new LockCollection<Guid>(EqualityComparer<Guid>.Default);
private HashSet<string> validatedMethods = null;
private HashSet<string> validatedMethods;

private readonly IFlowRepository repository;
private readonly ITapetiConfig config;
Expand Down
3 changes: 1 addition & 2 deletions Tapeti.Flow/FlowHelpers/MethodSerializer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Reflection;
using System.Reflection;
using System.Text.RegularExpressions;

namespace Tapeti.Flow.FlowHelpers
Expand Down
1 change: 1 addition & 0 deletions Tapeti/Config/IMessageContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;

// ReSharper disable UnusedMemberInSuper.Global - public API
// ReSharper disable UnusedMember.Global

namespace Tapeti.Config
{
Expand Down
9 changes: 5 additions & 4 deletions Tapeti/Connection/TapetiConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public async Task<ConsumeResult> Consume(string exchange, string routingKey, IMe
};

var exceptionContext = new ExceptionStrategyContext(emptyContext, dispatchException);
HandleException(exceptionContext);
await HandleException(exceptionContext);

return exceptionContext.ConsumeResult;
}
}
Expand Down Expand Up @@ -132,15 +133,15 @@ private async Task<ConsumeResult> InvokeUsingBinding(object message, MessageCont
catch (Exception invokeException)
{
var exceptionContext = new ExceptionStrategyContext(context, invokeException);
HandleException(exceptionContext);
await HandleException(exceptionContext);

await binding.Cleanup(context, exceptionContext.ConsumeResult);
return exceptionContext.ConsumeResult;
}
}


private void HandleException(ExceptionStrategyContext exceptionContext)
private async Task HandleException(ExceptionStrategyContext exceptionContext)
{
if (cancellationToken.IsCancellationRequested && IgnoreExceptionDuringShutdown(exceptionContext.Exception))
{
Expand All @@ -151,7 +152,7 @@ private void HandleException(ExceptionStrategyContext exceptionContext)

try
{
exceptionStrategy.HandleException(exceptionContext);
await exceptionStrategy.HandleException(exceptionContext);
}
catch (Exception strategyException)
{
Expand Down
5 changes: 2 additions & 3 deletions Tapeti/Default/ConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Text;
using Tapeti.Config;

// ReSharper disable UnusedMember.Global - public API

namespace Tapeti.Default
{
/// <inheritdoc />
Expand All @@ -17,9 +19,6 @@ public class ConsoleLogger : IBindingLogger
/// </summary>
public class WithMessageLogging : ConsoleLogger
{
/// <inheritdoc />
public WithMessageLogging() : base() { }

internal override bool IncludeMessageBody() => true;
}

Expand Down
6 changes: 4 additions & 2 deletions Tapeti/Default/NackExceptionStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Tapeti.Config;
using System.Threading.Tasks;
using Tapeti.Config;

namespace Tapeti.Default
{
Expand All @@ -9,9 +10,10 @@ namespace Tapeti.Default
public class NackExceptionStrategy : IExceptionStrategy
{
/// <inheritdoc />
public void HandleException(IExceptionStrategyContext context)
public Task HandleException(IExceptionStrategyContext context)
{
context.SetConsumeResult(ConsumeResult.Error);
return Task.CompletedTask;
}
}
}
6 changes: 4 additions & 2 deletions Tapeti/Default/RequeueExceptionStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Tapeti.Config;
using System.Threading.Tasks;
using Tapeti.Config;

// ReSharper disable UnusedMember.Global

Expand All @@ -20,9 +21,10 @@ namespace Tapeti.Default
public class RequeueExceptionStrategy : IExceptionStrategy
{
/// <inheritdoc />
public void HandleException(IExceptionStrategyContext context)
public Task HandleException(IExceptionStrategyContext context)
{
context.SetConsumeResult(ConsumeResult.Requeue);
return Task.CompletedTask;
}
}
}
5 changes: 3 additions & 2 deletions Tapeti/IExceptionStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Tapeti.Config;
using System.Threading.Tasks;
using Tapeti.Config;

namespace Tapeti
{
Expand All @@ -12,6 +13,6 @@ public interface IExceptionStrategy
/// </summary>
/// <param name="context">The exception strategy context containing the necessary data including the message context and the thrown exception.
/// Also proivdes methods for the exception strategy to indicate how the message should be handled.</param>
void HandleException(IExceptionStrategyContext context);
Task HandleException(IExceptionStrategyContext context);
}
}

0 comments on commit 447e354

Please sign in to comment.