From bb31b65499b8d9b9ec07ca3d3589a7f627817ab2 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 31 Aug 2022 14:20:52 +0100 Subject: [PATCH] Allow `AckAll` for pull-based consumers If you are the only client pulling on a given consumer, the efficiency gains of fetching batches is largely lost if you have to acknowledge every message you received individually. It would seem intuitive to be able to acknowledge only the most recent message in the batch instead. --- js.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js.go b/js.go index 6d5236c11..28211042a 100644 --- a/js.go +++ b/js.go @@ -1390,7 +1390,7 @@ func (js *js) subscribe(subj, queue string, cb MsgHandler, ch chan *Msg, isSync, // Some checks for pull subscribers if isPullMode { // Check for bad ack policy - if o.cfg.AckPolicy == AckNonePolicy || o.cfg.AckPolicy == AckAllPolicy { + if o.cfg.AckPolicy == AckNonePolicy { return nil, fmt.Errorf("nats: invalid ack mode for pull consumers: %s", o.cfg.AckPolicy) } // No deliver subject should be provided