Closed Wertual08 closed 1 week ago
Its exptected behaviour. That is how redeliveries work - it allows you to continue processing messages and get redeliveries for missed/unacked messages when their AckWait
threshold is reached.
To guarantee order, you need to use MaxAckPending = 1
, or an OrderedConsumer
if you want to quickly whip through the stream and discard the consumer (it uses client-side, no-ack logic with ephemeral consumers to ensure the order).
@Jarema oh, okay, thanks you very much for your answer. One more question: Why then order is dependent on time, which is passed between death of old consumer, and boot of new one?
Because messages is redelivered after AckWait
passes.
Also, for accuracy, it's not a new consumer, just client binding to it again.
Consumer is a server side construct, which state is held in the server/cluster.
Thanks again! Sorry for using your time, closing this issue.
Observed behavior
As far as I`m concern, stream consumer must process messages in order they were sent. But we faced the situation, when the order is somehow broken. If consumer fetched a batch of messages, no ack was sent to the server and consumer died, the following happens after new consumer is started: If new consumer boots up before AckWait, messages are received in expected order. If new consumer boots up after AckWait is passed, first message will become the last one...
I`m sorry if I did something wrong, but it seems to me as an issue with nats-server.
Expected behavior
Consumers are expected to process messages in order.
Server and client version
nats-server: v2.10.22 github.com/nats-io/nats.go v1.37.0
Host environment
Nats container: docker.io/nats:2.10.22 Go version: 1.21.6
Steps to reproduce
Go code
docker-compose.yml
Output: