forked from zarusz/SlimMessageBus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIConsumerErrorHandler.cs
More file actions
25 lines (24 loc) · 1.23 KB
/
Copy pathIConsumerErrorHandler.cs
File metadata and controls
25 lines (24 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
namespace SlimMessageBus.Host;
// doc:fragment:Interface
public interface IConsumerErrorHandler<in T>
{
/// <summary>
/// <para>
/// Executed when the message consumer (or handler) errors out. The interface allows for interception of
/// exceptions to manipulate the processing pipeline (success/fail/retry).
/// </para>
/// <para>
/// The consumer context is available to apply transport specific operations (acknowledge/reject/dead letter/etc).
/// </para>
/// <para>
/// If message execution is to be re-attempted, any delays/jitter should be applied before the method returns.
/// </para>
/// </summary>
/// <param name="message">The message that failed to process.</param>
/// <param name="consumerContext">The consumer context for the message processing pipeline.</param>
/// <param name="exception">Exception that occurred during message processing.</param>
/// <param name="attempts">The number of times the message has been attempted to be processed.</param>
/// <returns>The error handling result.</returns>
Task<ProcessResult> OnHandleError(T message, IConsumerContext consumerContext, Exception exception, int attempts);
}
// doc:fragment:Interface