28 lines
1.3 KiB
C#
Executable File
28 lines
1.3 KiB
C#
Executable File
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ZB.MOM.WW.CBDDC.Core.Resilience;
|
|
|
|
public interface IRetryPolicy
|
|
{
|
|
/// <summary>
|
|
/// Executes an asynchronous operation with retry handling.
|
|
/// </summary>
|
|
/// <param name="operation">The operation to execute.</param>
|
|
/// <param name="operationName">The operation name used for diagnostics.</param>
|
|
/// <param name="cancellationToken">A token used to cancel the operation.</param>
|
|
/// <returns>A task that represents the asynchronous execution.</returns>
|
|
Task ExecuteAsync(Func<Task> operation, string operationName, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Executes an asynchronous operation with retry handling and returns a result.
|
|
/// </summary>
|
|
/// <typeparam name="T">The result type.</typeparam>
|
|
/// <param name="operation">The operation to execute.</param>
|
|
/// <param name="operationName">The operation name used for diagnostics.</param>
|
|
/// <param name="cancellationToken">A token used to cancel the operation.</param>
|
|
/// <returns>A task that represents the asynchronous execution and yields the operation result.</returns>
|
|
Task<T> ExecuteAsync<T>(Func<Task<T>> operation, string operationName,
|
|
CancellationToken cancellationToken = default);
|
|
} |