Name another module's own-stream subject in the SDK too (issue 1242)
mesh/delivery merged: source.main moved to novox/mesh-sdk@9f92233a2890
mesh/delivery-group group fix/1242-bus-helper merged: every member is merged
mesh/check checking 8ad9372b1952 on a262c7dbe0ff | novox/mesh-sdk#108 in group fix/1242-bus-helper

This commit is contained in:
2026-10-27 20:38:20 +01:00
parent 3236cbad43
commit 8ad9372b19
2 changed files with 7 additions and 2 deletions
+1
View File
@@ -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 {
+6 -2
View File
@@ -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.<module>.event.<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: <node>_<module>.