Documentation
¶
Overview ¶
Package event provides the event bus for workflow coordination, supporting both in-memory and store-backed event publish/subscribe with WaitForEvent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus provides high-level publish/subscribe operations over an event Store. Workflows use the Bus via WaitForEvent; external code publishes events through it to trigger workflow continuations.
type Event ¶
type Event struct {
ID id.EventID `json:"id"`
Name string `json:"name"`
Payload []byte `json:"payload,omitempty"`
ScopeAppID string `json:"scope_app_id,omitempty"`
ScopeOrgID string `json:"scope_org_id,omitempty"`
Acked bool `json:"acked"`
CreatedAt time.Time `json:"created_at"`
}
Event represents a named event published to the event bus. Workflows can wait for events using WaitForEvent, enabling external triggers and inter-workflow coordination.
type Store ¶
type Store interface {
// PublishEvent persists a new event and makes it available for subscribers.
PublishEvent(ctx context.Context, evt *Event) error
// SubscribeEvent waits for an unacked event matching the given name.
// Blocks until an event is available or the timeout expires.
// Returns nil if no event is found within the timeout.
SubscribeEvent(ctx context.Context, name string, timeout time.Duration) (*Event, error)
// AckEvent acknowledges an event, marking it as consumed.
AckEvent(ctx context.Context, eventID id.EventID) error
}
Store defines the persistence contract for events.
Click to show internal directories.
Click to hide internal directories.