From a448ed8b765f7c34c0913418d55c2d9995432176 Mon Sep 17 00:00:00 2001 From: Neil Twigg Date: Wed, 31 Jan 2024 11:16:58 +0000 Subject: [PATCH] Add `PausedUntil` to consumer config, `Paused` and `PauseRemaining` to consumer info Signed-off-by: Neil Twigg --- jetstream/consumer_config.go | 10 ++++++++++ js.go | 3 +++ 2 files changed, 13 insertions(+) diff --git a/jetstream/consumer_config.go b/jetstream/consumer_config.go index 0ff4672bc..39d062cdc 100644 --- a/jetstream/consumer_config.go +++ b/jetstream/consumer_config.go @@ -75,6 +75,13 @@ type ( // TimeStamp indicates when the info was gathered by the server. TimeStamp time.Time `json:"ts"` + + // Paused reports if the consumer is currently paused or not. + Paused bool `json:"paused,omitempty"` + + // PauseRemaining contains the amount of time left until the consumer + // unpauses. It will only be non-zero if the consumer is currently paused. + PauseRemaining time.Duration `json:"pause_remaining,omitempty"` } // ConsumerConfig is the configuration of a JetStream consumer. @@ -217,6 +224,9 @@ type ( // associating metadata on the consumer. This feature requires // nats-server v2.10.0 or later. Metadata map[string]string `json:"metadata,omitempty"` + + // PauseUntil is for suspending the consumer until the deadline. + PauseUntil time.Time `json:"pause_until,omitempty"` } // OrderedConsumerConfig is the configuration of an ordered JetStream diff --git a/js.go b/js.go index 462fea17e..90c2ce057 100644 --- a/js.go +++ b/js.go @@ -1167,6 +1167,9 @@ type ConsumerConfig struct { // Keys starting with `_nats` are reserved. // NOTE: Metadata requires nats-server v2.10.0+ Metadata map[string]string `json:"metadata,omitempty"` + + // PauseUntil is for suspending the consumer until the deadline. + PauseUntil time.Time `json:"pause_until,omitempty"` } // ConsumerInfo is the info from a JetStream consumer.