Topic-based pubsub library.
Install with:
go get github.com/dewadg/haro
intTopic := haro.DeclareTopic[int]()
stringTopic := haro.DeclareTopic[string]()
intTopic.Subscribe(func(ctx context.Context, p int) error {
return nil
})
stringTopic.Subscribe(func(ctx context.Context, p string) error {
return nil
})
var err error
err = intTopic.Publish(context.Background(), 5)
err = stringTopic.Publish(context.Background(), "test")
- It's not a distributed pubsub mechanism, it means pubsub across different instances won't work (eg: across docker container replication)
- No recovery since it doesn't utilize any external storage, it's purely using Channel to store the published messages