Documentation
¶
Index ¶
- type CommandEventBus
- func (bus *CommandEventBus) Clear()
- func (bus *CommandEventBus) Emit(eventType string, event interface{})
- func (bus *CommandEventBus) HasPendingEvents() bool
- func (bus *CommandEventBus) Subscribe(eventType string, handler func(interface{})) func()
- func (bus *CommandEventBus) SubscribeOnce(eventType string, handler func(interface{})) func()
- func (bus *CommandEventBus) WaitForPendingEvents()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandEventBus ¶
type CommandEventBus struct {
// contains filtered or unexported fields
}
CommandEventBus is an event bus for command-level internal communication. It is separate from the backend event bus and handles command-specific events. Unlike the backend EventBus, this supports unsubscribe, subscribe-once, and ID-based management.
func NewCommandEventBus ¶
func NewCommandEventBus() *CommandEventBus
NewCommandEventBus creates a new command-level event bus
func (*CommandEventBus) Emit ¶
func (bus *CommandEventBus) Emit(eventType string, event interface{})
Emit sends an event to all subscribers of the given event type. Handlers are called asynchronously in separate goroutines.
func (*CommandEventBus) HasPendingEvents ¶
func (bus *CommandEventBus) HasPendingEvents() bool
HasPendingEvents returns true if there are event handlers currently running
func (*CommandEventBus) Subscribe ¶
func (bus *CommandEventBus) Subscribe(eventType string, handler func(interface{})) func()
Subscribe registers a handler for a specific event type. Returns an unsubscribe function.
func (*CommandEventBus) SubscribeOnce ¶
func (bus *CommandEventBus) SubscribeOnce(eventType string, handler func(interface{})) func()
SubscribeOnce registers a handler that will only be called once
func (*CommandEventBus) WaitForPendingEvents ¶
func (bus *CommandEventBus) WaitForPendingEvents()
WaitForPendingEvents blocks until all currently pending event handlers complete