Files
next.orly.dev/pkg/protocol/publish/publisher.go
mleku 110223fc4e Migrate internal module imports to unified package path.
Replaced legacy `*.orly` module imports with `next.orly.dev/pkg` paths across the codebase for consistency. Removed legacy `go.mod` files from sub-packages, consolidating dependency management. Added Dockerfiles and configurations for benchmarking environments.
2025-09-12 16:12:31 +01:00

39 lines
667 B
Go

package publish
import (
"next.orly.dev/pkg/encoders/event"
"next.orly.dev/pkg/interfaces/publisher"
"next.orly.dev/pkg/interfaces/typer"
)
// S is the control structure for the subscription management scheme.
type S struct {
publisher.Publishers
}
// New creates a new publish.S.
func New(p ...publisher.I) (s *S) {
s = &S{Publishers: p}
return
}
var _ publisher.I = &S{}
func (s *S) Type() string { return "publish" }
func (s *S) Deliver(ev *event.E) {
for _, p := range s.Publishers {
p.Deliver(ev)
}
}
func (s *S) Receive(msg typer.T) {
t := msg.Type()
for _, p := range s.Publishers {
if p.Type() == t {
p.Receive(msg)
return
}
}
}