diff --git a/go/process/account_test.go b/go/process/account_test.go index 10c30b2..2d6e54e 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"}, + {"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"}, } { if c.got != c.want { diff --git a/go/process/module.go b/go/process/module.go index 8310bfe..de68222 100644 --- a/go/process/module.go +++ b/go/process/module.go @@ -69,8 +69,12 @@ func (a Account) EventSubject(event string) string { return "mesh.mod." + a.Modu // StreamSubject is where the module's event lands on a stream of its own: mesh.stream..event. // (mesh-controller internal/broker/modstreams.go ModuleStreamSubject). -func (a Account) StreamSubject(event string) string { - return "mesh.stream." + a.Module + ".event." + event +func (a Account) StreamSubject(event string) string { return ModuleStreamSubject(a.Module, 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 { + return "mesh.stream." + module + ".event." + event } // EventConsumerName is the module's durable consumer on a stream it is granted: _.