Documentation
¶
Index ¶
- Constants
- Variables
- type Bus
- func (b *Bus) Emit(ctx context.Context, eventType string, data any) error
- func (b *Bus) EmitAsync(ctx context.Context, eventType string, data any)
- func (b *Bus) EmitEvent(ctx context.Context, event *Event) error
- func (b *Bus) Shutdown(ctx context.Context) error
- func (b *Bus) Subscribe(eventType string, handler Handler, opts ...Option) *Subscription
- func (b *Bus) Unsubscribe(sub *Subscription)
- func (b *Bus) WaitForShutdown() <-chan struct{}
- type Event
- type Handler
- type Option
- type Subscription
Constants ¶
View Source
const ( EventMessage = "message" EventCommand = "command" EventRawUpdate = "raw_update" EventShutdown = "shutdown" EventStart = "start" EventError = "error" )
Variables ¶
View Source
var ErrHandlerTimeout = errors.New("eventbus: handler timed out")
ErrHandlerTimeout is returned when a handler exceeds its execution deadline.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
func New ¶
func New(logger interfaces.Logger) *Bus
func (*Bus) Subscribe ¶
func (b *Bus) Subscribe(eventType string, handler Handler, opts ...Option) *Subscription
func (*Bus) Unsubscribe ¶
func (b *Bus) Unsubscribe(sub *Subscription)
func (*Bus) WaitForShutdown ¶
func (b *Bus) WaitForShutdown() <-chan struct{}
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.