diff --git a/jetstream/consumer_config.go b/jetstream/consumer_config.go index 0ff4672bc..2016372af 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,15 @@ type ( // associating metadata on the consumer. This feature requires // nats-server v2.10.0 or later. Metadata map[string]string `json:"metadata,omitempty"` + + // PauseUntil pauses the consumer until the given deadline. When + // paused, the consumer will continue to send heartbeats but will not + // deliver any messages. The consumer will unpause automatically when + // the deadline is reached and messages will flow again automatically. + // Setting this to a zero timestamp, or any time in the past, results + // in the consumer being unpaused. + // This feature requires nats-server v2.11.0 or later. + 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..7dfbf594a 100644 --- a/js.go +++ b/js.go @@ -1167,6 +1167,15 @@ 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 pauses the consumer until the given deadline. When + // paused, the consumer will continue to send heartbeats but will not + // deliver any messages. The consumer will unpause automatically when + // the deadline is reached and messages will flow again automatically. + // Setting this to a zero timestamp, or any time in the past, results + // in the consumer being unpaused. + // NOTE: Consumer pause requires nats-server v2.11.0+ + PauseUntil time.Time `json:"pause_until,omitempty"` } // ConsumerInfo is the info from a JetStream consumer.