Documentation
¶
Index ¶
- type SimpleInMemoryEventBus
- func (b *SimpleInMemoryEventBus) Publish(ctx context.Context, evt event.Event) error
- func (b *SimpleInMemoryEventBus) Start(ctx context.Context) error
- func (b *SimpleInMemoryEventBus) Stop(ctx context.Context) error
- func (b *SimpleInMemoryEventBus) Subscribe(ctx context.Context, eventName string, handler event.EventHandler) error
- func (b *SimpleInMemoryEventBus) Unsubscribe(ctx context.Context, eventName string, handler event.EventHandler) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleInMemoryEventBus ¶
type SimpleInMemoryEventBus struct {
// contains filtered or unexported fields
}
SimpleInMemoryEventBus is a basic, in-process event bus implementation. Note: This implementation is for simple use cases and does not persist events. Handlers are executed synchronously in the publisher's goroutine.
func NewSimpleInMemoryEventBus ¶
func NewSimpleInMemoryEventBus() *SimpleInMemoryEventBus
NewSimpleInMemoryEventBus creates a new SimpleInMemoryEventBus.
func (*SimpleInMemoryEventBus) Publish ¶
Publish executes all registered handlers for a given event.
func (*SimpleInMemoryEventBus) Start ¶
func (b *SimpleInMemoryEventBus) Start(ctx context.Context) error
Start does nothing for this simple in-memory bus.
func (*SimpleInMemoryEventBus) Stop ¶
func (b *SimpleInMemoryEventBus) Stop(ctx context.Context) error
Stop does nothing for this simple in-memory bus.
func (*SimpleInMemoryEventBus) Subscribe ¶
func (b *SimpleInMemoryEventBus) Subscribe(ctx context.Context, eventName string, handler event.EventHandler) error
Subscribe registers an event handler for a specific event name.
func (*SimpleInMemoryEventBus) Unsubscribe ¶
func (b *SimpleInMemoryEventBus) Unsubscribe(ctx context.Context, eventName string, handler event.EventHandler) error
Unsubscribe removes a specific event handler for an event name. Note: Unsubscribing based on function equality can be unreliable in Go. A more robust implementation would require handlers to have unique IDs.