Give a work-queue stream its one consumer, drop-only dead letters (issue 1178)

This commit is contained in:
jochen
2026-10-19 02:33:22 +02:00
parent 97ee33e8f4
commit de651e0fd1
16 changed files with 467 additions and 22 deletions
@@ -36,3 +36,21 @@ func TestANonWorkQueueStreamStillDropsItsOldest(t *testing.T) {
t.Fatalf("composed as %+v; want limits retention, never discarding new, no duplicate window", s)
}
}
// 1178/AC1: the process a work-queue stream's bus.queues names gets exactly one durable consumer,
// <node>_<module>_<process id>, with the stream's declared max-deliver — composed even though mesh-mail's
// sender otherwise consumes and watches nothing of its own, which alone would give ConsumerFor nothing
// needed. Explicit acknowledgement is EnsureConsumer's own rule for every consumer it makes (jetstream.go),
// so it is not re-asserted here.
func TestTheOneProcessAWorkQueuesBusNamesGetsItsOwnConsumer(t *testing.T) {
sender := Principal{Kind: KindModule, Node: "novox", Module: "mesh-mail", PasswordHash: "x",
Queues: []QueueOwner{{Process: "send", Stream: "MAIL_SENDS", MaxDeliver: 5}}}
got := ConsumersOf([]Principal{sender})
if len(got) != 1 {
t.Fatalf("mesh-mail's consumers: %+v", got)
}
c := got[0].Consumer
if c.Name != "novox_mesh-mail_send" || c.Stream != "MAIL_SENDS" || c.MaxDeliver != 5 {
t.Fatalf("the queue's consumer: %+v", c)
}
}