forked from zarusz/SlimMessageBus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zarusz#347 Refactor IConsumerErrorHandler to return a 'retry' respons…
…e instead of supplying a 'retry' delegate
- Loading branch information
Showing
31 changed files
with
710 additions
and
590 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
6 changes: 3 additions & 3 deletions
6
src/SlimMessageBus.Host.AmazonSQS/Consumer/ISqsConsumerErrorHandler.cs
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.AmazonSQS; | ||
|
||
public interface ISqsConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface ISqsConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class SqsConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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
6 changes: 3 additions & 3 deletions
6
src/SlimMessageBus.Host.AzureEventHub/Consumer/IEventHubConsumerErrorHandler.cs
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.AzureEventHub; | ||
|
||
public interface IEventHubConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface IEventHubConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class EventHubConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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,9 +1,9 @@ | ||
global using Microsoft.Extensions.Logging; | ||
global using Azure.Messaging.EventHubs; | ||
global using Azure.Messaging.EventHubs.Producer; | ||
global using Azure.Storage.Blobs; | ||
|
||
global using Microsoft.Extensions.Logging; | ||
|
||
global using SlimMessageBus.Host; | ||
global using SlimMessageBus.Host.Collections; | ||
global using SlimMessageBus.Host.Consumer.ErrorHandling; | ||
global using SlimMessageBus.Host.Services; | ||
|
||
global using Azure.Messaging.EventHubs; | ||
global using Azure.Messaging.EventHubs.Producer; | ||
global using Azure.Storage.Blobs; |
6 changes: 3 additions & 3 deletions
6
src/SlimMessageBus.Host.AzureServiceBus/Consumer/IServiceBusConsumerErrorHandler.cs
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.AzureServiceBus; | ||
|
||
public interface IServiceBusConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface IServiceBusConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class ServiceBusConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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,8 +1,8 @@ | ||
global using Microsoft.Extensions.Logging; | ||
global using Azure.Messaging.ServiceBus; | ||
global using Azure.Messaging.ServiceBus.Administration; | ||
|
||
global using Microsoft.Extensions.Logging; | ||
|
||
global using SlimMessageBus.Host; | ||
global using SlimMessageBus.Host.Collections; | ||
global using SlimMessageBus.Host.Consumer.ErrorHandling; | ||
global using SlimMessageBus.Host.Services; | ||
|
||
global using Azure.Messaging.ServiceBus; | ||
global using Azure.Messaging.ServiceBus.Administration; |
6 changes: 3 additions & 3 deletions
6
src/SlimMessageBus.Host.Kafka/Consumer/IKafkaConsumerErrorHandler.cs
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.Kafka; | ||
|
||
public interface IKafkaConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface IKafkaConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class KafkaConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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
6 changes: 3 additions & 3 deletions
6
src/SlimMessageBus.Host.Memory/Consumers/IMemoryConsumerErrorHandler.cs
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.Memory; | ||
|
||
public interface IMemoryConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface IMemoryConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class MemoryConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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,3 +1,4 @@ | ||
global using Microsoft.Extensions.Logging; | ||
|
||
global using SlimMessageBus.Host.Serialization; | ||
global using SlimMessageBus.Host.Consumer.ErrorHandling; | ||
global using SlimMessageBus.Host.Serialization; |
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.Mqtt; | ||
|
||
public interface IMqttConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface IMqttConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class MqttConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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,5 +1,6 @@ | ||
global using Microsoft.Extensions.Logging; | ||
|
||
global using SlimMessageBus.Host.Services; | ||
global using NATS.Client.Core; | ||
|
||
global using NATS.Client.Core; | ||
global using SlimMessageBus.Host.Consumer.ErrorHandling; | ||
global using SlimMessageBus.Host.Services; |
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.Nats; | ||
|
||
public interface INatsConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface INatsConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class NatsConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
6 changes: 3 additions & 3 deletions
6
src/SlimMessageBus.Host.RabbitMQ/Consumers/IRabbitMqConsumerErrorHandler.cs
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.RabbitMQ; | ||
|
||
public interface IRabbitMqConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface IRabbitMqConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class RabbitMqConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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
6 changes: 3 additions & 3 deletions
6
src/SlimMessageBus.Host.Redis/Consumers/IRedisConsumerErrorHandler.cs
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,5 +1,5 @@ | ||
namespace SlimMessageBus.Host.Redis; | ||
|
||
public interface IRedisConsumerErrorHandler<in T> : IConsumerErrorHandler<T> | ||
{ | ||
} | ||
public interface IRedisConsumerErrorHandler<in T> : IConsumerErrorHandler<T>; | ||
|
||
public abstract class RedisConsumerErrorHandler<T> : ConsumerErrorHandler<T>; |
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,7 +1,8 @@ | ||
global using Microsoft.Extensions.Logging; | ||
|
||
global using SlimMessageBus.Host.Collections; | ||
global using SlimMessageBus.Host.Consumer.ErrorHandling; | ||
global using SlimMessageBus.Host.Serialization; | ||
global using SlimMessageBus.Host.Services; | ||
|
||
global using StackExchange.Redis; | ||
global using StackExchange.Redis; |
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
13 changes: 13 additions & 0 deletions
13
src/SlimMessageBus.Host/Consumer/ErrorHandling/ConsumerErrorHandler.cs
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace SlimMessageBus.Host.Consumer.ErrorHandling; | ||
|
||
public abstract class ConsumerErrorHandler<T> : BaseConsumerErrorHandler, IConsumerErrorHandler<T> | ||
{ | ||
public abstract Task<ConsumerErrorHandlerResult> OnHandleError(T message, IConsumerContext consumerContext, Exception exception, int attempts); | ||
} | ||
|
||
public abstract class BaseConsumerErrorHandler | ||
{ | ||
public static ConsumerErrorHandlerResult Failure() => ConsumerErrorHandlerResult.Failure; | ||
public static ConsumerErrorHandlerResult Retry() => ConsumerErrorHandlerResult.Retry; | ||
public static ConsumerErrorHandlerResult Success(object response = null) => response == null ? ConsumerErrorHandlerResult.Success : ConsumerErrorHandlerResult.SuccessWithResponse(response); | ||
} |
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
Oops, something went wrong.