mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Set AckAll option automatically if batch size is greater than 1
This commit is contained in:
parent
4d89e020b3
commit
8e1f004843
|
|
@ -34,6 +34,14 @@ func JetStreamConsumer(
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// If the batch size is greater than 1, we will want to acknowledge all
|
||||||
|
// received messages in the batch. Below we will send an acknowledgement
|
||||||
|
// for the most recent message in the batch and AckAll will ensure that
|
||||||
|
// all messages that came before it are also acknowledged implicitly.
|
||||||
|
if batch > 1 {
|
||||||
|
opts = append(opts, nats.AckAll())
|
||||||
|
}
|
||||||
|
|
||||||
name := durable + "Pull"
|
name := durable + "Pull"
|
||||||
sub, err := js.PullSubscribe(subj, name, opts...)
|
sub, err := js.PullSubscribe(subj, name, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue