Class ErrorPolicyBaseBuilder<TBuilder>
- Namespace
- Silverback.Messaging.Configuration
- Assembly
- Silverback.Integration.dll
Builds an ErrorPolicyBase.
public abstract class ErrorPolicyBaseBuilder<TBuilder> where TBuilder : ErrorPolicyBaseBuilder<TBuilder>
Type Parameters
TBuilderThe actual builder type.
- Inheritance
-
ErrorPolicyBaseBuilder<TBuilder>
- Derived
- Inherited Members
Constructors
ErrorPolicyBaseBuilder()
protected ErrorPolicyBaseBuilder()
Properties
This
Gets this instance.
protected abstract TBuilder This { get; }
Property Value
- TBuilder
Remarks
This is necessary to work around casting in the base classes.
Methods
ApplyTo(Type)
Restricts the application of this policy to the specified exception type only. It is possible to
combine multiple calls to ApplyTo and Exclude.
public TBuilder ApplyTo(Type exceptionType)
Parameters
exceptionTypeTypeThe type of the exception to be handled.
Returns
- TBuilder
The policy builder 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.
public TBuilder ApplyTo<T>() where T : Exception
Returns
- TBuilder
The policy builder so that additional calls can be chained.
Type Parameters
TThe type of the exception to be handled.
ApplyWhen(Func<IRawInboundEnvelope, bool>)
Specifies a predicate to be used to determine whether the policy has to be applied according to the current message and exception.
public TBuilder ApplyWhen(Func<IRawInboundEnvelope, bool> applyRule)
Parameters
applyRuleFunc<IRawInboundEnvelope, bool>The predicate.
Returns
- TBuilder
The policy builder so that additional calls can be chained.
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.
public TBuilder ApplyWhen(Func<IRawInboundEnvelope, Exception, bool> applyRule)
Parameters
applyRuleFunc<IRawInboundEnvelope, Exception, bool>The predicate.
Returns
- TBuilder
The policy builder so that additional calls can be chained.
Build()
Builds the error policy instance.
public ErrorPolicyBase Build()
Returns
- ErrorPolicyBase
The error policy.
BuildCore()
Builds the error policy instance.
protected abstract ErrorPolicyBase BuildCore()
Returns
- ErrorPolicyBase
The error policy.
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.
public TBuilder Exclude(Type exceptionType)
Parameters
exceptionTypeTypeThe type of the exception to be ignored.
Returns
- TBuilder
The policy builder 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.
public TBuilder Exclude<T>() where T : Exception
Returns
- TBuilder
The policy builder so that additional calls can be chained.
Type Parameters
TThe type of the exception to be ignored.
Publish(Func<IRawInboundEnvelope, Exception, object?>)
Specify a factory to create a message to be published via the message bus when this policy is applied. Useful to execute some custom code.
public TBuilder Publish(Func<IRawInboundEnvelope, Exception, object?> factory)
Parameters
factoryFunc<IRawInboundEnvelope, Exception, object>The factory returning the message to be published.
Returns
- TBuilder
The policy builder so that additional calls can be chained.
Publish(Func<IRawInboundEnvelope, object?>)
Specify a factory to create a message to be published via the message bus when this policy is applied. Useful to execute some custom code.
public TBuilder Publish(Func<IRawInboundEnvelope, object?> factory)
Parameters
factoryFunc<IRawInboundEnvelope, object>The factory returning the message to be published.
Returns
- TBuilder
The policy builder so that additional calls can be chained.