From f84fe54c6c8367da5e25bb868eb8036c05663d19 Mon Sep 17 00:00:00 2001 From: jochens Date: Fri, 13 Nov 2026 01:29:59 +0100 Subject: [PATCH] mesh-sdk: Account.BusSubject names the subject of a template stream (A-41) Builds: design 42 zfs-owns-zfs A-41 --- go/process/account_test.go | 1 + go/process/module.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/go/process/account_test.go b/go/process/account_test.go index 2d6e54e0..bb6b2013 100644 --- a/go/process/account_test.go +++ b/go/process/account_test.go @@ -265,6 +265,7 @@ func TestModuleAccountNamesAndDialOptions(t *testing.T) { for _, c := range []struct{ name, got, want string }{ {"event subject", a.EventSubject("put"), "mesh.mod.mesh-delivery-teller.event.put"}, {"own stream subject", a.StreamSubject("forge.x.pull"), "mesh.stream.mesh-delivery-teller.event.forge.x.pull"}, + {"template stream subject", a.BusSubject("events", "snapshot.taken.person"), "mesh.bus.mesh-delivery-teller.events.snapshot.taken.person"}, {"another module's stream subject", ModuleStreamSubject("mesh-delivery-checker", "check"), "mesh.stream.mesh-delivery-checker.event.check"}, {"durable consumer", a.EventConsumerName(), "n1_mesh-delivery-teller"}, } { diff --git a/go/process/module.go b/go/process/module.go index de682222..6e3d4fe8 100644 --- a/go/process/module.go +++ b/go/process/module.go @@ -71,6 +71,12 @@ func (a Account) EventSubject(event string) string { return "mesh.mod." + a.Modu // (mesh-controller internal/broker/modstreams.go ModuleStreamSubject). func (a Account) StreamSubject(event string) string { return ModuleStreamSubject(a.Module, event) } +// BusSubject is where the module's event lands on a stream it asked for by template: mesh.bus..., +// being the stream's local name in the module's `requires` (the bus module's keeper, PlanOf; A-41). +func (a Account) BusSubject(local, event string) string { + return "mesh.bus." + a.Module + "." + local + "." + event +} + // ModuleStreamSubject is where a module's event lands on that module's own stream, for a part that names another // module's stream (the indexer hears the forge bridge's, the checker's) without holding its credential. func ModuleStreamSubject(module, event string) string {