Documentation ¶
Index ¶
- Variables
- type EventBus
- func (b *EventBus) AddHandler(handler eh.EventHandler, eventType eh.EventType)
- func (b *EventBus) AddObserver(observer eh.EventObserver)
- func (b *EventBus) Close() error
- func (b *EventBus) PublishEvent(ctx context.Context, event eh.Event)
- func (b *EventBus) SetHandlingStrategy(strategy eh.EventHandlingStrategy)
Constants ¶
This section is empty.
Variables ¶
var ErrCouldNotMarshalEvent = errors.New("could not marshal event")
ErrCouldNotMarshalEvent is when an event could not be marshaled into BSON.
var ErrCouldNotUnmarshalEvent = errors.New("could not unmarshal event")
ErrCouldNotUnmarshalEvent is when an event could not be unmarshaled into a concrete type.
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus is an event bus that notifies registered EventHandlers of published events. It will use the SimpleEventHandlingStrategy by default.
func NewEventBus ¶
NewEventBus creates a EventBus.
func (*EventBus) AddHandler ¶
func (b *EventBus) AddHandler(handler eh.EventHandler, eventType eh.EventType)
AddHandler implements the AddHandler method of the eventhorizon.EventBus interface.
func (*EventBus) AddObserver ¶
func (b *EventBus) AddObserver(observer eh.EventObserver)
AddObserver implements the AddObserver method of the eventhorizon.EventBus interface.
func (*EventBus) PublishEvent ¶
PublishEvent implements the PublishEvent method of the eventhorizon.EventBus interface.
func (*EventBus) SetHandlingStrategy ¶
func (b *EventBus) SetHandlingStrategy(strategy eh.EventHandlingStrategy)
SetHandlingStrategy implements the SetHandlingStrategy method of the eventhorizon.EventBus interface.