Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/NATS.Client.JetStream/NatsJSOpts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,25 @@ public record NatsJSPubOpts : NatsPubOpts
// lss *uint64 // Expected last sequence per subject
public ulong? ExpectedLastSubjectSequence { get; init; }

// Publish retries for NoResponders err.
// rwait time.Duration // Retry wait between attempts
/// <summary>
/// Specifies the duration to wait between retry attempts for a failed publish operation.
/// See <see cref="RetryAttempts"/> for the number of retry attempts.
/// </summary>
public TimeSpan RetryWaitBetweenAttempts { get; init; } = TimeSpan.FromMilliseconds(250);

// rnum int // Retry attempts
public int RetryAttempts { get; init; } = 2;
/// <summary>
/// Specifies the number of retry attempts to publish a message when a "NoResponders" error occurs.
/// The value defines how many additional attempts will be made after the initial publish attempt.
/// Default is not to retry (one attempt total).
/// </summary>
/// <remarks>
/// By default, this is set to 1, meaning that if the first publish attempt fails with a "NoResponders" error,
/// no more attempts will be made. Setting this to a higher value allows for more retries in case of transient issues.
/// Coupled with <see cref="RetryWaitBetweenAttempts"/>, this provides a mechanism to handle temporary unavailability of responders,
/// however, for more robust handling of such scenarios, consider implementing an exponential backoff strategy in your application logic,
/// or use an extension that supports it.
/// </remarks>
public int RetryAttempts { get; init; } = 1;
}

/// <summary>
Expand Down
Loading