Class ErrorPolicyBaseBuilder<TBuilder>
Builds an ErrorPolicyBase.
Inheritance
Inherited Members
Namespace: Silverback.Messaging.Configuration
Assembly: Silverback.Integration.dll
Syntax
public abstract class ErrorPolicyBaseBuilder<TBuilder> where TBuilder : ErrorPolicyBaseBuilder<TBuilder>
Type Parameters
| Name | Description |
|---|---|
| TBuilder | The actual builder type. |
Constructors
ErrorPolicyBaseBuilder()
Builds an ErrorPolicyBase.
Declaration
protected ErrorPolicyBaseBuilder()
Properties
This
Gets this instance.
Declaration
protected abstract TBuilder This { get; }
Property Value
| Type | Description |
|---|---|
| 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.
Declaration
public TBuilder ApplyTo(Type exceptionType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | exceptionType | The type of the exception to be handled. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public TBuilder ApplyTo<T>() where T : Exception
Returns
| Type | Description |
|---|---|
| TBuilder | The policy builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| T | The 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.
Declaration
public TBuilder ApplyWhen(Func<IRawInboundEnvelope, bool> applyRule)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IRawInboundEnvelope, bool> | applyRule | The predicate. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public TBuilder ApplyWhen(Func<IRawInboundEnvelope, Exception, bool> applyRule)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IRawInboundEnvelope, Exception, bool> | applyRule | The predicate. |
Returns
| Type | Description |
|---|---|
| TBuilder | The policy builder so that additional calls can be chained. |
Build()
Builds the error policy instance.
Declaration
public ErrorPolicyBase Build()
Returns
| Type | Description |
|---|---|
| ErrorPolicyBase | The error policy. |
BuildCore()
Builds the error policy instance.
Declaration
protected abstract ErrorPolicyBase BuildCore()
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public TBuilder Exclude(Type exceptionType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | exceptionType | The type of the exception to be ignored. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public TBuilder Exclude<T>() where T : Exception
Returns
| Type | Description |
|---|---|
| TBuilder | The policy builder 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 via the message bus when this policy is applied. Useful to execute some custom code.
Declaration
public TBuilder 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 |
|---|---|
| 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.
Declaration
public TBuilder Publish(Func<IRawInboundEnvelope, object?> factory)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IRawInboundEnvelope, object> | factory | The factory returning the message to be published. |
Returns
| Type | Description |
|---|---|
| TBuilder | The policy builder so that additional calls can be chained. |