Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ID string `json:"id"`
Source string `json:"source"`
SpecVersion string `json:"specversion"`
Type string `json:"type"`
Data map[string]any `json:"data"`
Time time.Time `json:"time"`
}
Event represents a generic event
type EventBus ¶
type EventBus interface {
Publish(ctx context.Context, event Event) error
Subscribe(eventType string, handler func(ctx context.Context, event Event)) error
Close() error // Clean up resources
}
EventBus defines the interface for publishing and subscribing to events
var DefaultEventBus EventBus
type EventWithCtx ¶ added in v0.7.0
type EventWithCtx struct {
// contains filtered or unexported fields
}
EventWithCtx couples an event with its associated context.
type MemoryEventBus ¶ added in v0.7.0
type MemoryEventBus struct {
// contains filtered or unexported fields
}
MemoryEventBus is an in-memory implementation of the EventBus using channels.
func NewMemoryEventBus ¶ added in v0.7.0
func NewMemoryEventBus() (*MemoryEventBus, error)
NewEventBus creates a new MemoryEventBus.
func (*MemoryEventBus) Close ¶ added in v0.7.0
func (b *MemoryEventBus) Close() error
Close shuts down the event bus and cleans up all channels.
Click to show internal directories.
Click to hide internal directories.