Give a work-queue stream its one consumer, drop-only dead letters (issue 1178)
This commit is contained in:
@@ -65,3 +65,25 @@ func TestANonWorkQueueStreamIsCarriedAsNotAWorkQueue(t *testing.T) {
|
||||
t.Fatalf("the plain stream: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
// 1178/AC1: the process a work-queue stream's bus.queues names is read from the manifest, by its resource
|
||||
// id, with the stream's own max-deliveries — what the broker composes the one durable consumer from.
|
||||
func TestTheQueueOwnersOfAWorkQueueStreamAreReadFromItsProcess(t *testing.T) {
|
||||
sender := catalogue.Manifest{Module: "mesh-mail", Emits: []string{"mail.send.sent", "mail.send.failed"},
|
||||
Streams: []catalogue.StreamDeclaration{{Name: "mail-sends", Events: []string{"mail.send.approved"},
|
||||
Retention: catalogue.StreamRetentionWorkQueue, MaxDeliveries: 5}},
|
||||
Resources: []map[string]any{
|
||||
{"id": "account", "type": "user", "name": "mesh-mail-send"},
|
||||
{"id": "send", "type": "process", "run": []any{"./mesh-mail", "send"}, "user": "mesh-mail-send",
|
||||
"bus": map[string]any{"emits": []any{"mail.send.sent", "mail.send.failed"},
|
||||
"queues": []any{"mail-sends"}}},
|
||||
}}
|
||||
got := queueOwnersOf(sender)
|
||||
if len(got) != 1 || got[0].Process != "send" || got[0].Stream != "MAIL_SENDS" || got[0].MaxDeliver != 5 {
|
||||
t.Fatalf("the sender's queue owners: %+v", got)
|
||||
}
|
||||
// And a module with no process declaring bus has none.
|
||||
if got := queueOwnersOf(catalogue.Manifest{Module: "feed"}); got != nil {
|
||||
t.Fatalf("a module with no process bus has queue owners: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user