Documentation
¶
Overview ¶
Package event provides an event dispatcher for the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher interface {
// Dispatch sends an event to all registered handlers.
Dispatch(ctx context.Context, event Event) error
// Subscribe registers a handler for the given event type.
Subscribe(eventType EventType, handler Handler)
// Unsubscribe removes a handler from the given event type.
Unsubscribe(eventType EventType, handler Handler)
}
Dispatcher dispatches events to registered handlers.
func NewNoOpDispatcher ¶
func NewNoOpDispatcher() Dispatcher
NewNoOpDispatcher creates a new no-op dispatcher.
type EventType ¶
type EventType string
EventType represents the type of an event.
const ( EventJobCreated EventType = "job.created" EventJobScheduled EventType = "job.scheduled" EventJobStarted EventType = "job.started" EventJobCompleted EventType = "job.completed" EventJobFailed EventType = "job.failed" EventJobCancelled EventType = "job.cancelled" EventJobRetrying EventType = "job.retrying" )
Job lifecycle events.
type NoOpDispatcher ¶
type NoOpDispatcher struct{}
NoOpDispatcher is a dispatcher that does nothing. Useful for testing or when events are not needed.
func (*NoOpDispatcher) Dispatch ¶
func (d *NoOpDispatcher) Dispatch(_ context.Context, _ Event) error
Dispatch does nothing.
func (*NoOpDispatcher) Subscribe ¶
func (d *NoOpDispatcher) Subscribe(_ EventType, _ Handler)
Subscribe does nothing.
func (*NoOpDispatcher) Unsubscribe ¶
func (d *NoOpDispatcher) Unsubscribe(_ EventType, _ Handler)
Unsubscribe does nothing.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package builder provides a fluent API for constructing events.
|
Package builder provides a fluent API for constructing events. |
|
Package bus provides the core event bus functionality for pub/sub messaging.
|
Package bus provides the core event bus functionality for pub/sub messaging. |
|
Package dispatcher provides event dispatching with persistence.
|
Package dispatcher provides event dispatching with persistence. |
|
Package handlers provides specialized event handlers for complex event processing.
|
Package handlers provides specialized event handlers for complex event processing. |
|
Package repository provides data access for events.
|
Package repository provides data access for events. |
|
Package subscribers provides built-in event subscribers.
|
Package subscribers provides built-in event subscribers. |
Click to show internal directories.
Click to hide internal directories.