feat: enforce jetstream ack and redelivery semantics

This commit is contained in:
Joseph Doherty
2026-02-23 06:09:26 -05:00
parent fecb51095f
commit d3aad48096
7 changed files with 104 additions and 7 deletions

View File

@@ -0,0 +1,17 @@
namespace NATS.Server.Tests;
public class JetStreamAckRedeliveryTests
{
[Fact]
public async Task Unacked_message_is_redelivered_after_ack_wait()
{
await using var fixture = await JetStreamApiFixture.StartWithAckExplicitConsumerAsync(ackWaitMs: 50);
await fixture.PublishAndGetAckAsync("orders.created", "1");
var first = await fixture.FetchAsync("ORDERS", "PULL", batch: 1);
var second = await fixture.FetchAfterDelayAsync("ORDERS", "PULL", delayMs: 75, batch: 1);
second.Messages.Single().Sequence.ShouldBe(first.Messages.Single().Sequence);
second.Messages.Single().Redelivered.ShouldBeTrue();
}
}