Documentation ¶
Index ¶
- Variables
- type Bus
- func (b *Bus) Close()
- func (b *Bus) Listeners(topic string) int
- func (b *Bus) On(topic string, buffer int) (xid.ID, <-chan *pubsub.Message)
- func (b *Bus) Once(topic string) (xid.ID, <-chan *pubsub.Message)
- func (b *Bus) Publish(topic string, msg *pubsub.Message) error
- func (b *Bus) Unsubscribe(topic string, id xid.ID)
- type Listener
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBusIsClosed is returned when the Bus has been closed and a Publish is attempted. ErrBusIsClosed = errors.New("bus has closed") )
View Source
var ( // ErrListenerIsClosed is returned when a listener is closed and a Send is attempted ErrListenerIsClosed = errors.New("listener is closed") )
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is an event bus responsible for sending/receiving events.
func (*Bus) Close ¶
func (b *Bus) Close()
Close closes all listener channels and empties the list of subscribed listeners.
func (*Bus) Listeners ¶
Listeners returns the number of listeners that are registered for a given topic.
func (*Bus) Once ¶
Once subscribes to a specific topic. The listener will be closed immediately after at least one message is received.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener tracks a single subscription.
func (*Listener) Close ¶
func (l *Listener) Close()
Close closes the channel and prevents further message sending.
func (*Listener) HasReceivedMessages ¶
HasReceivedMessages returns true if the Listener has receives at least once message.
Click to show internal directories.
Click to hide internal directories.