I am using nats streaming server and stan.client as client library.
My subscriber can do long work. Sometimes they are greater than default ack wait time (30sec). So I try to manually ack my message, doing like this:
StanSubscriptionOptions sOpts = StanSubscriptionOptions.GetDefaultOptions();
sOpts.ManualAcks = true;
EventHandler<StanMsgHandlerArgs> msgHandler = (sender, args) =>
{
args.Message.Ack();
Thread.Sleep(40000);
};
sOpts.DurableName = "my-durable";
var s = c.Subscribe(subject, qGroup, sOpts, msgHandler);
I set the manual ack then I ack the message as first action, before my work.
In this code, subscriber does a work for 40sec. If I send 2 messages, the second has always redelivered.
What is my mistake?