broker: the substrate pre-declares a consumer's dead-lettered queue (ADR 0048)

LavinMQ refuses a non-administrator declaring a queue with a dead-letter
exchange, so a scoped module cannot make its own. EnsureModuleQueue declares
<node>.<module>.events with its DLX as the mesh, and 'module issue' does so
for a consuming module — the runtime then passively checks it rather than
declaring. Verified against a real broker: the scoped account binds and
consumes the pre-declared queue.

Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
This commit is contained in:
2026-09-04 01:51:17 +02:00
parent f41d280e66
commit 64496f0335
2 changed files with 22 additions and 0 deletions
+7
View File
@@ -243,6 +243,13 @@ func moduleCommand(ctx context.Context, args []string) error {
if err != nil {
return err
}
// A consumer's queue, with its dead-letter, is the substrate's to declare — its own account
// may not (ADR 0048). Made now, so it exists before the module binds onto it.
if len(m.Consumes) > 0 {
if err := management.EnsureModuleQueue(ctx, *forNode, module); err != nil {
return err
}
}
known, err := broker.FromEnvironment()
if err != nil {