Documentation ¶
Index ¶
- Constants
- type Event
- type EventBus
- func (e *EventBus) Publish(eventType EventType, evt Event)
- func (e *EventBus) Subscribe(eventType EventType) (EventSubscriberId, <-chan Event)
- func (e *EventBus) SubscribeFunc(eventType EventType, handlerFunc EventHandlerFunc) EventSubscriberId
- func (e *EventBus) Unsubscribe(eventType EventType, subId EventSubscriberId)
- type EventHandlerFunc
- type EventSubscriberId
- type EventType
Constants ¶
View Source
const (
EventQueueSize = 20
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
func NewEventBus ¶
func NewEventBus(promRegistry prometheus.Registerer) *EventBus
NewEventBus creates a new EventBus
func (*EventBus) Publish ¶
Publish allows a producer to send an event of a particular type to all subscribers
func (*EventBus) Subscribe ¶
func (e *EventBus) Subscribe( eventType EventType, ) (EventSubscriberId, <-chan Event)
Subscribe allows a consumer to receive events of a particular type via a channel
func (*EventBus) SubscribeFunc ¶
func (e *EventBus) SubscribeFunc( eventType EventType, handlerFunc EventHandlerFunc, ) EventSubscriberId
SubscribeFunc allows a consumer to receive events of a particular type via a callback function
func (*EventBus) Unsubscribe ¶
func (e *EventBus) Unsubscribe(eventType EventType, subId EventSubscriberId)
Unsubscribe stops delivery of events for a particular type for an existing subscriber
type EventHandlerFunc ¶
type EventHandlerFunc func(Event)
type EventSubscriberId ¶
type EventSubscriberId int
Click to show internal directories.
Click to hide internal directories.