Skip to content

Commit

Permalink
Add advisories for pull consumer groups
Browse files Browse the repository at this point in the history
Signed-off-by: R.I.Pienaar <[email protected]>
  • Loading branch information
ripienaar committed Aug 2, 2024
1 parent 914d63e commit 49ed0c9
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion adr/ADR-42.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,38 @@ type PriorityGroupState struct {
Future iterations will include delivery stats per group.

Once multiple groups are supported consumer updates could add and remove groups. Today only the `PriorityTimeout`
setting supports being updated.
setting supports being updated.

#### Advisories

We will publish advisories when a switch is performed and when a pin is lost.

```golang
const JSStreamGroupPinnedAdvisoryType = "io.nats.jetstream.advisory.v1.consumer_group_pinned"

// JSStreamGroupPinnedAdvisory that a group switched to a new pinned client
type JSStreamGroupPinnedAdvisory struct {
TypedEvent
Account string `json:"account,omitempty"`
Stream string `json:"stream"`
Consumer string `json:"consumer"`
Domain string `json:"domain,omitempty"`
Group string `json:"group"`
PinnedClientId string `json:"pinned_id"`
Client *ClientInfo `json:"client"` // if available
}

const JSStreamGroupUnPinnedAdvisoryType = "io.nats.jetstream.advisory.v1.consumer_group_unpinned"

// JSStreamGroupUnPinnedAdvisory indicates that a pin was lost
type JSStreamGroupUnPinnedAdvisory struct {
TypedEvent
Account string `json:"account,omitempty"`
Stream string `json:"stream"`
Consumer string `json:"consumer"`
Domain string `json:"domain,omitempty"`
Group string `json:"group"`
// one of "admin" or "timeout", could be an enum up to the implementor to decide
Reason string `json:"reason"`
}
```

0 comments on commit 49ed0c9

Please sign in to comment.