feat: wire consumer pause/resume API endpoint (Gap 7.5)
Enhances HandlePause to parse pause_until (RFC3339) for time-bounded pauses and returns current pause state in the response body. Adds Paused/PauseUntil properties and PauseResponse factory to JetStreamApiResponse. Covers 10 new parity tests.
This commit is contained in:
@@ -17,6 +17,18 @@ public sealed class JetStreamApiResponse
|
||||
public bool Success { get; init; }
|
||||
public ulong Purged { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the consumer is currently paused. Populated by pause/resume API responses.
|
||||
/// Go reference: server/consumer.go jsConsumerPauseResponse.paused field.
|
||||
/// </summary>
|
||||
public bool? Paused { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// UTC deadline until which the consumer is paused. Null when no deadline is set.
|
||||
/// Go reference: server/consumer.go jsConsumerPauseResponse.pause_until field.
|
||||
/// </summary>
|
||||
public DateTime? PauseUntil { get; init; }
|
||||
|
||||
public static JetStreamApiResponse NotFound(string subject) => new()
|
||||
{
|
||||
Error = new JetStreamApiError
|
||||
@@ -66,6 +78,17 @@ public sealed class JetStreamApiResponse
|
||||
Success = true,
|
||||
Purged = purged,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pause/resume success response with current pause state.
|
||||
/// Go reference: server/consumer.go jsConsumerPauseResponse — returned after pause/resume API call.
|
||||
/// </summary>
|
||||
public static JetStreamApiResponse PauseResponse(bool paused, DateTime? pauseUntil) => new()
|
||||
{
|
||||
Success = true,
|
||||
Paused = paused,
|
||||
PauseUntil = pauseUntil,
|
||||
};
|
||||
}
|
||||
|
||||
public sealed class JetStreamStreamInfo
|
||||
@@ -102,6 +125,15 @@ public sealed class JetStreamDirectMessage
|
||||
public sealed class JetStreamSnapshot
|
||||
{
|
||||
public string Payload { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>Stream name this snapshot was taken from.</summary>
|
||||
public string? StreamName { get; init; }
|
||||
|
||||
/// <summary>Number of chunks the snapshot was split into (1 for non-chunked snapshots).</summary>
|
||||
public int NumChunks { get; init; }
|
||||
|
||||
/// <summary>Block/chunk size in bytes.</summary>
|
||||
public int BlkSize { get; init; }
|
||||
}
|
||||
|
||||
public sealed class JetStreamPullBatch
|
||||
|
||||
Reference in New Issue
Block a user