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 |
|---|---|
| Func<IRawInboundEnvelope, Exception, bool> |
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 |
|---|---|
| ICollection<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 |
|---|---|
| ICollection<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 |
|---|---|
| int? |
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 |
|---|---|
| Func<IRawInboundEnvelope, Exception, 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 |
|---|---|---|
| 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, bool>)
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 |
|---|---|---|
| Func<IRawInboundEnvelope, Exception, bool> | applyRule | The predicate. |
Returns
| Type | Description |
|---|---|
| ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |
Build(IServiceProvider)
Returns the actual error policy implementation, built using the provided IServiceProvider.
Declaration
public IErrorPolicyImplementation Build(IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | serviceProvider | The IServiceProvider to be used to build the error policy. |
Returns
| Type | Description |
|---|---|
| IErrorPolicyImplementation | An instance of IErrorPolicyImplementation that can be used to handle the processing error. |
BuildCore(IServiceProvider)
Returns the actual error policy implementation, built using the provided IServiceProvider.
Declaration
protected abstract ErrorPolicyImplementation BuildCore(IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | serviceProvider | The IServiceProvider to be used to build the error policy. |
Returns
| Type | Description |
|---|---|
| ErrorPolicyImplementation | An instance of IErrorPolicyImplementation that can be used to handle the processing error. |
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 |
|---|---|---|
| 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 |
|---|---|---|
| Func<IRawInboundEnvelope, Exception, 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 |
|---|---|---|
| Func<IRawInboundEnvelope, object> | factory | The factory returning the message to be published. |
Returns
| Type | Description |
|---|---|
| ErrorPolicyBase | The ErrorPolicyBase so that additional calls can be chained. |