Class ErrorPolicyBase
Builds the error policy.
Inheritance
Implements
Inherited Members
Namespace: Silverback.Messaging.Inbound.ErrorHandling
Assembly: Silverback.Integration.dll
Syntax
public abstract class ErrorPolicyBase : IErrorPolicy
Properties
| Improve this doc View sourceApplyRule
Gets the custom apply rule function.
Declaration
public Func<IRawInboundEnvelope, Exception, bool> ApplyRule { get; }
Property Value
Type | Description |
---|---|
System.Func<IRawInboundEnvelope, System.Exception, System.Boolean> |
ExcludedExceptions
Gets the collection of exception types this policy doesn't have to be applied to.
Declaration
public ICollection<Type> ExcludedExceptions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<System.Type> |
IncludedExceptions
Gets the collection of exception types this policy have to be applied to.
Declaration
public ICollection<Type> IncludedExceptions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<System.Type> |
MaxFailedAttemptsCount
Gets the number of times this policy should be applied to the same message in case of multiple failed attempts.
Declaration
public int? MaxFailedAttemptsCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
MessageToPublishFactory
Gets the factory that builds the message to be published after the policy is applied.
Declaration
public Func<IRawInboundEnvelope, Exception, object> MessageToPublishFactory { get; }
Property Value
Type | Description |
---|---|
System.Func<IRawInboundEnvelope, System.Exception, System.Object> |
Methods
| Improve this doc View sourceApplyTo(Type)
Restricts the application of this policy to the specified exception type only. It is possible to
combine multiple calls to ApplyTo
and Exclude
.
Declaration
public ErrorPolicyBase ApplyTo(Type exceptionType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | exceptionType | The type of the exception to be handled. |
Returns
Type | Description |
---|---|
ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |
ApplyTo<T>()
Restricts the application of this policy to the specified exception type only. It is possible to
combine multiple calls to ApplyTo
and Exclude
.
Declaration
public ErrorPolicyBase ApplyTo<T>()
where T : Exception
Returns
Type | Description |
---|---|
ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |
Type Parameters
Name | Description |
---|---|
T | The type of the exception to be handled. |
ApplyWhen(Func<IRawInboundEnvelope, Exception, Boolean>)
Specifies a predicate to be used to determine whether the policy has to be applied according to the current message and exception.
Declaration
public ErrorPolicyBase ApplyWhen(Func<IRawInboundEnvelope, Exception, bool> applyRule)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IRawInboundEnvelope, System.Exception, System.Boolean> | applyRule | The predicate. |
Returns
Type | Description |
---|---|
ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |
Build(IServiceProvider)
Declaration
public IErrorPolicyImplementation Build(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | serviceProvider |
Returns
Type | Description |
---|---|
IErrorPolicyImplementation |
BuildCore(IServiceProvider)
Declaration
protected abstract ErrorPolicyImplementation BuildCore(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | serviceProvider |
Returns
Type | Description |
---|---|
ErrorPolicyImplementation |
Exclude(Type)
Restricts the application of this policy to all exceptions but the specified type. It is possible to
combine multiple calls to ApplyTo
and Exclude
.
Declaration
public ErrorPolicyBase Exclude(Type exceptionType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | exceptionType | The type of the exception to be ignored. |
Returns
Type | Description |
---|---|
ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |
Exclude<T>()
Restricts the application of this policy to all exceptions but the specified type. It is possible to
combine multiple calls to ApplyTo
and Exclude
.
Declaration
public ErrorPolicyBase Exclude<T>()
where T : Exception
Returns
Type | Description |
---|---|
ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |
Type Parameters
Name | Description |
---|---|
T | The type of the exception to be ignored. |
Publish(Func<IRawInboundEnvelope, Exception, Object>)
Specify a factory to create a message to be published to the internal bus when this policy is applied. Useful to execute some custom code.
Declaration
public ErrorPolicyBase Publish(Func<IRawInboundEnvelope, Exception, object> factory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IRawInboundEnvelope, System.Exception, System.Object> | factory | The factory returning the message to be published. |
Returns
Type | Description |
---|---|
ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |
Publish(Func<IRawInboundEnvelope, Object>)
Specify a factory to create a message to be published to the internal bus when this policy is applied. Useful to execute some custom code.
Declaration
public ErrorPolicyBase Publish(Func<IRawInboundEnvelope, object> factory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IRawInboundEnvelope, System.Object> | factory | The factory returning the message to be published. |
Returns
Type | Description |
---|---|
ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |