Documentation ¶
Index ¶
Constants ¶
View Source
const ( ListenerAdded = "listener_added" ListenerRemoved = "listener_removed" )
internal listener events
View Source
const ( SubscriberAdded = "subscriber_added" SubscriberRemoved = "subscriber_removed" )
internal subscription events
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
Dispatcher abstraction for event dispatchers
func NewDispatcher ¶
func NewDispatcher(logger logger.FormatLogger) Dispatcher
NewDispatcher returns a new instance of event.Dispatcher
type Event ¶
type Event interface { Context() context.Context Payload() interface{} StopPropagation() PropagationStopped() bool }
Event generic event type alias
func DefaultEvent ¶ added in v0.0.5
DefaultEvent return a new Event
func ListenerEvent ¶ added in v0.0.5
func ListenerEvent(ctx context.Context, id, eventName string, priority int, listener Listener) Event
ListenerEvent return a new event.Event
func SubscriberEvent ¶ added in v0.0.5
func SubscriberEvent(ctx context.Context, id string, subscriber Subscriber) Event
SubscriberEvent return a new event.Event
type Registry ¶ added in v0.0.5
type Registry interface { AddListener(eventName string, listener Listener) string AddListenerWithPriority(eventName string, listener Listener, priority int) string AddSubscriber(subscriber Subscriber) string RemoveListener(listenerID string) RemoveSubscriber(subscriberID string) }
Registry abstraction for event registries
type Subscriber ¶
type Subscriber interface {
GetSubscriptions() []Subscription
}
Subscriber abstraction for event subscribers
type Subscription ¶
Subscription abstraction for event subscriptions
func NewSubscription ¶
func NewSubscription(eventName string, listener Listener) Subscription
NewSubscription return a new instance of Subscription
func NewSubscriptionWithPriority ¶
func NewSubscriptionWithPriority(eventName string, listener Listener, priority int) Subscription
NewSubscriptionWithPriority return a new instance of Subscription with priority
Click to show internal directories.
Click to hide internal directories.