Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventFilter ¶
type EventFilter struct {
WorkflowID string `json:"workflow_id,omitempty"`
EventTypes []string `json:"event_types,omitempty"`
}
EventFilter specifies which events a subscriber wants to receive.
type EventHub ¶
type EventHub interface {
Publish(ctx context.Context, event StreamEvent) error
Subscribe(ctx context.Context, filter EventFilter) (<-chan StreamEvent, func(), error)
}
EventHub provides pub/sub for real-time workflow events.
type MemoryHub ¶
type MemoryHub struct {
// contains filtered or unexported fields
}
MemoryHub is an in-memory EventHub implementation using channels.
func (*MemoryHub) Publish ¶
func (h *MemoryHub) Publish(ctx context.Context, event StreamEvent) error
Publish sends an event to all matching subscribers. Non-blocking: if a subscriber's channel is full the event is dropped.
func (*MemoryHub) Subscribe ¶
func (h *MemoryHub) Subscribe(ctx context.Context, filter EventFilter) (<-chan StreamEvent, func(), error)
Subscribe creates a new subscription filtered by the given EventFilter. Returns a receive-only channel, a cancel function, and any error.
Click to show internal directories.
Click to hide internal directories.