Open ripienaar opened 2 months ago
The PR has been merged: https://github.com/nats-io/nats-server/pull/5066
Schemas PR, which is probably the best source of information how to implement the feature: https://github.com/nats-io/jsm.go/pull/522/files
Request and response schemas:
// io.nats.jetstream.api.v1.consumer_pause_request
type JSApiConsumerPauseRequest struct {
PauseUntil time.Time `json:"pause_until,omitempty"`
}
// io.nats.jetstream.api.v1.consumer_pause_response
type JSApiConsumerPauseResponse struct {
JSApiResponse
Paused bool `json:"paused"`
PauseUntil time.Time `json:"pause_until"`
PauseRemaining time.Duration `json:"pause_remaining,omitempty"`
}
Consumer info includes 2 new fields:
Paused bool json:"paused,omitempty"
PauseRemaining time.Duration json:"pause_remaining,omitempty"
The paused state and time time would need to be persisted to the raft layer such that server restarts would not unpause paused consumers. This is done using the consumer configuration that has a new value:
PauseUntil time.Time json:"pause_until,omitempty"
Go Client: https://github.com/nats-io/nats.go/pull/1571
Java client: https://github.com/nats-io/nats.java/pull/1093
.NET.v2 client: https://github.com/nats-io/nats.net.v2/pull/432
Rust Client: https://github.com/nats-io/nats.rs/pull/1234
☝️ All of these contributions are so cool to see 😄
Overview
In 2.11 consumers can be paused using the API and optionally started paused.
Clients should at the very least support the added fields to config and state for consumers, but might be handy to also add some utilities.
Initial server issue https://github.com/nats-io/nats-server/issues/4966
NOTE This is not merged at the moment, hold until merged. Also review the PR or schemas rather than the Issue for latest implementation detail
Clients and Tools
Other Tasks
Implemented
Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.