-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement consumer pause/resume Signed-off-by: Maurice van Veen <[email protected]> * Add (Pause/Resume)Consumer to MockJsContext Signed-off-by: Maurice van Veen <[email protected]> * Add test for TimeSpan? in TimeSpanJsonTests.cs Signed-off-by: Maurice van Veen <[email protected]> * Rename to IsPaused & make ConsumerPauseResponse immutable Signed-off-by: Maurice van Veen <[email protected]> * Test fixes --------- Signed-off-by: Maurice van Veen <[email protected]> Co-authored-by: Ziya Suzen <[email protected]>
- Loading branch information
1 parent
271210f
commit 1c11db3
Showing
12 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace NATS.Client.JetStream.Models; | ||
|
||
/// <summary> | ||
/// A request to the JetStream $JS.API.CONSUMER.PAUSE API | ||
/// </summary> | ||
internal record ConsumerPauseRequest | ||
{ | ||
[System.Text.Json.Serialization.JsonPropertyName("pause_until")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
public DateTimeOffset? PauseUntil { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using NATS.Client.JetStream.Internal; | ||
|
||
namespace NATS.Client.JetStream.Models; | ||
|
||
/// <summary> | ||
/// A response from the JetStream $JS.API.CONSUMER.PAUSE API | ||
/// </summary> | ||
public record ConsumerPauseResponse | ||
{ | ||
[System.Text.Json.Serialization.JsonPropertyName("paused")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
#if NET6_0 | ||
public bool IsPaused { get; set; } | ||
#else | ||
public bool IsPaused { get; init; } | ||
#endif | ||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pause_until")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
#if NET6_0 | ||
public DateTimeOffset PauseUntil { get; set; } | ||
#else | ||
public DateTimeOffset PauseUntil { get; init; } | ||
#endif | ||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pause_remaining")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
[System.Text.Json.Serialization.JsonConverter(typeof(NatsJSJsonNullableNanosecondsConverter))] | ||
#if NET6_0 | ||
public TimeSpan? PauseRemaining { get; set; } | ||
#else | ||
public TimeSpan? PauseRemaining { get; init; } | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters