Skip to content

Commit

Permalink
feat(pubsub): implement publisher interface
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian committed Sep 12, 2023
1 parent 9938e9a commit ab0e471
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pubsub/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ var ErrNotRunning = errors.New("not running")
// Event interface
type Event interface{}

type Publisher interface {
Publish(Event) error
}

// Bus is an async event bus that allows subscriptions to behave as a bus themselves.
// When an event is published, it is sent to all subscribers asynchronously - a subscriber
// cannot block other subscribers.
//
// NOTE: this should probably be in util/event or something (not in provider/event)
type Bus interface {
Publish(Event) error
Publisher
Subscribe() (Subscriber, error)
Close()
Done() <-chan struct{}
Expand Down

0 comments on commit ab0e471

Please sign in to comment.