Jetstream durable queue-group subscription based MaxAckPending #2799
ccapuano-ssc
started this conversation in
Ideas
Replies: 2 comments 6 replies
-
I might suggest that in JetStream this use case is better suited to pull consumers. They scale out by design and you can supply a batch size they are willing to take. In addition you can create a consumer with a MaxBatch to control how many messages any number of subscribers could ask for, say 5 as in above. |
Beta Was this translation helpful? Give feedback.
5 replies
-
Once you have a JetStream context you can create or bind an existing pull consumer as follows. sub, err := js.PullSubscribe("foo", "bar") // foo is subject, bar is durable name. Then you can do.. msgs, err := sub.Fetch(1, nats.MaxWait(60*time.Minute)) That tells the system (server 2.7.2 or greater IIRC) to return 1 message waiting a maximum of 1hr.. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
Working on a recent project where we are moving from NATS streaming to JetStream. We have, and would like to maintain, async push subscriptions to a Jetstream Consumer created as a durable queue group. The issue we are facing is when additional subscriptions are created, the MaxAckPending property of the Consumer does not change based on the number of subscribers.
Proposed Solution
Our requirement would be to allow a subscription to define a MaxAckPending rather than on the consumer. This would allow a level of elastic scalability with push subscriptions we don't seem to be able to achieve in the current version (2.6.6).
In practice, we would like to have a additional subscriptions to the consumer take up to a configured amount of messages. In an example, if we specified a MaxSubscriptionAckPending of 5, and subscribed 3 times we should have a Consumer MaxAckPending of 15 with each subscription not receiving more than 5 messages at a time.
Beta Was this translation helpful? Give feedback.
All reactions