Documentation
¶
Overview ¶
Package event defines the domain-event contract and the in-process synchronous event bus shared by all Tupic services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is an in-memory synchronous event bus for domain events with subscription and publishing capabilities.
func (*Bus) PublishAll ¶
func (eb *Bus) PublishAll(ctx context.Context, events []DomainEvent) error
PublishAll dispatches events in order, aborting on the first handler error.
type DomainEvent ¶
type DomainEvent interface {
Name() string
}
DomainEvent is the contract every aggregate-raised event implements.
type Handler ¶
type Handler func(ctx context.Context, e DomainEvent) error
Handler reacts to a single domain event.
type Publisher ¶
type Publisher interface {
Publish(ctx context.Context, e DomainEvent) error
// PublishAll dispatches events in order, aborting on the first handler error.
PublishAll(ctx context.Context, events []DomainEvent) error
}
Publisher dispatches domain events to the in-process sync event bus.
type Subscriber ¶
Subscriber registers domain event handlers on the in-process sync event bus.
Click to show internal directories.
Click to hide internal directories.