Class ErrorPolicyImplementation
Inheritance
Implements
Inherited Members
Namespace: Silverback.Messaging.Inbound.ErrorHandling
Assembly: Silverback.Integration.dll
Syntax
public abstract class ErrorPolicyImplementation : IErrorPolicyImplementation
Constructors
| Improve this doc View sourceErrorPolicyImplementation(Nullable<Int32>, ICollection<Type>, ICollection<Type>, Func<IRawInboundEnvelope, Exception, Boolean>, Func<IRawInboundEnvelope, Exception, Object>, IServiceProvider, IInboundLogger<ErrorPolicyBase>)
Initializes a new instance of the ErrorPolicyImplementation class.
Declaration
protected ErrorPolicyImplementation(int? maxFailedAttempts, ICollection<Type> excludedExceptions, ICollection<Type> includedExceptions, Func<IRawInboundEnvelope, Exception, bool> applyRule, Func<IRawInboundEnvelope, Exception, object> messageToPublishFactory, IServiceProvider serviceProvider, IInboundLogger<ErrorPolicyBase> logger)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | maxFailedAttempts | The number of times this policy should be applied to the same message in case of multiple failed attempts. |
System.Collections.Generic.ICollection<System.Type> | excludedExceptions | The collection of exception types this policy doesn't have to be applied to. |
System.Collections.Generic.ICollection<System.Type> | includedExceptions | The collection of exception types this policy have to be applied to. |
System.Func<IRawInboundEnvelope, System.Exception, System.Boolean> | applyRule | The custom apply rule function. |
System.Func<IRawInboundEnvelope, System.Exception, System.Object> | messageToPublishFactory | The factory that builds the message to be published after the policy is applied. |
System.IServiceProvider | serviceProvider | The System.IServiceProvider. |
IInboundLogger<ErrorPolicyBase> | logger |
Methods
| Improve this doc View sourceApplyPolicyAsync(ConsumerPipelineContext, Exception)
Executes the current policy.
Declaration
protected abstract Task<bool> ApplyPolicyAsync(ConsumerPipelineContext context, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
ConsumerPipelineContext | context | The ConsumerPipelineContext related to the message that failed to be processed. |
System.Exception | exception | The exception that was thrown during the processing. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | A System.Threading.Tasks.Task<TResult> representing the asynchronous operation. The task result contains the action that the consumer should perform (e.g. skip the message or stop consuming). |
CanHandle(ConsumerPipelineContext, Exception)
Declaration
public virtual bool CanHandle(ConsumerPipelineContext context, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
ConsumerPipelineContext | context | |
System.Exception | exception |
Returns
Type | Description |
---|---|
System.Boolean |
HandleErrorAsync(ConsumerPipelineContext, Exception)
Declaration
public async Task<bool> HandleErrorAsync(ConsumerPipelineContext context, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
ConsumerPipelineContext | context | |
System.Exception | exception |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> |