Interface IErrorPolicyImplementation
- Namespace
- Silverback.Messaging.Consuming.ErrorHandling
- Assembly
- Silverback.Integration.dll
An error policy is used to handle errors that may occur while processing the inbound messages.
public interface IErrorPolicyImplementation
Methods
CanHandle(ConsumerPipelineContext, Exception)
Returns a boolean value indicating whether the policy can handle the specified envelopes and the specified exception.
bool CanHandle(ConsumerPipelineContext context, Exception exception)
Parameters
contextConsumerPipelineContextThe ConsumerPipelineContext related to the message that failed to be processed.
exceptionExceptionThe exception that was thrown during the processing.
Returns
- bool
A value indicating whether the specified envelopes and exception can be handled.
HandleErrorAsync(ConsumerPipelineContext, Exception)
Performs the necessary actions to handle the error (including invoking the IConsumerTransactionManager).
Task<bool> HandleErrorAsync(ConsumerPipelineContext context, Exception exception)
Parameters
contextConsumerPipelineContextThe ConsumerPipelineContext related to the message that failed to be processed.
exceptionExceptionThe exception that was thrown during the processing.
Returns
- Task<bool>
A Task<TResult> representing the asynchronous operation. The task result contains a boolean flag indicating whether the error was handled. If
falseis returned the exception will be rethrown and the consumer will stop.