-
Notifications
You must be signed in to change notification settings - Fork 233
Open
Labels
proposalEnhancement idea or proposalEnhancement idea or proposal
Description
Proposed change
Server 2.11 introduced jetstream consumer priority groups from ADR-42 (2.11 release notes for initial addition, 2.12 release notes for prioritized policy addition).
From looking at the original nats.go implementation in nats-io/nats.go@93f7ce4c, I believe the translation of this would roughly be:
- 3 new js consumer config fields:
nats.js.api.ConsumerConfig.{priority_policy,priority_timeout,priority_groups} - 3 new options on
nats.js.client.JetStreamContext.{pull_subscribe(),pull_subscribe_bind()}(or could just rely on sdk user manually creating multiple consumer configs for the same consumer group to configure these themselves):pull_min_pending,pull_min_ack_pending,pull_priority_group - modification to the
nats.js.client.JetstreamContext.PullSubscription.{_fetch_one(),_fetch_n()}methods to handle priority groups in the pull request: need to addid,group,min_pending,min_ack_pending,priority - 1 new js api method:
nats.js.manager.JetstreamManager.unpin_consumer() - 1 new js error:
nats.js.errors.PinIdMismatchError(error code 423) - 1 new js consumer info field:
nats.js.api.ConsumerInfo.priority_groups
Use case
Would then allow the implementation of, among other things, partitioned consumer groups – which are super useful for doing things like event sourcing without having to set max ack pending to 1 and slowing a consumer to a crawl
Contribution
I'm happy to make a PR I have made a PR: #786
Metadata
Metadata
Assignees
Labels
proposalEnhancement idea or proposalEnhancement idea or proposal