feat: add resilient reconnect and catch-up replay
This commit is contained in:
28
src/SuiteLink.Client/SuiteLinkRuntimeOptions.cs
Normal file
28
src/SuiteLink.Client/SuiteLinkRuntimeOptions.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace SuiteLink.Client;
|
||||
|
||||
public sealed record class SuiteLinkRuntimeOptions
|
||||
{
|
||||
public SuiteLinkRuntimeOptions(
|
||||
SuiteLinkRetryPolicy retryPolicy,
|
||||
SuiteLinkCatchUpPolicy catchUpPolicy,
|
||||
TimeSpan catchUpTimeout)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(retryPolicy);
|
||||
|
||||
if (catchUpTimeout <= TimeSpan.Zero)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(catchUpTimeout), catchUpTimeout, "Catch-up timeout must be positive.");
|
||||
}
|
||||
|
||||
RetryPolicy = retryPolicy;
|
||||
CatchUpPolicy = catchUpPolicy;
|
||||
CatchUpTimeout = catchUpTimeout;
|
||||
}
|
||||
|
||||
public SuiteLinkRetryPolicy RetryPolicy { get; init; }
|
||||
public SuiteLinkCatchUpPolicy CatchUpPolicy { get; init; }
|
||||
public TimeSpan CatchUpTimeout { get; init; }
|
||||
|
||||
public static SuiteLinkRuntimeOptions Default { get; } =
|
||||
new(SuiteLinkRetryPolicy.Default, SuiteLinkCatchUpPolicy.None, TimeSpan.FromSeconds(2));
|
||||
}
|
||||
Reference in New Issue
Block a user