Versions in this module Expand all Collapse all v1 v1.0.2 Aug 23, 2026 Changes in this version + var ErrActorUnavailable = errors.New("event: actor unavailable") + var ErrClosed = errors.New("event: dispatcher closed") + var ErrCodec = errors.New("event: codec failure") + var ErrInvalidConfig = errors.New("event: invalid config") + var ErrInvalidEvent = errors.New("event: invalid event") + var ErrNoSubscriber = errors.New("event: no subscriber") + var ErrNotReady = errors.New("event: dispatcher not ready") + var ErrQueueFull = errors.New("event: queue full") + type Codec interface + Decode func(context.Context, []byte) (any, error) + Encode func(context.Context, any) ([]byte, error) + type Config struct + ActorSystemName string + Codec Codec + DeadLetterSink DeadLetterSink + ErrorClassifier ErrorClassifier + HandlerTimeout time.Duration + MaxAttempts int + Partitions int + PublishPolicy QueuePolicy + QueueCapacity int + RetryInitialBackoff time.Duration + RetryMaxBackoff time.Duration + Store Store + func DefaultConfig() Config + type DeadLetter struct + Attempts int + Event Event + FailedAt time.Time + LastError error + PanicValue any + Panicked bool + type DeadLetterSink interface + Handle func(context.Context, DeadLetter) error + type DeadLetterSinkFunc func(context.Context, DeadLetter) error + func (f DeadLetterSinkFunc) Handle(ctx context.Context, dead DeadLetter) error + type DeliveryStatus uint8 + const DeliveryAccepted + const DeliveryCancelled + const DeliveryCompleted + const DeliveryDeadLettered + const DeliveryFailed + const DeliveryRejected + type Dispatcher interface + Health func() HealthSnapshot + Metrics func() MetricsSnapshot + Shutdown func(context.Context) error + State func() State + Subscribe func(string, Handler, ...SubscribeOption) (Subscription, error) + type ErrorClassifier func(error) bool + type Event struct + CreatedAt time.Time + ID string + Key string + Metadata map[string]string + Payload any + Topic string + func (e Event) Validate() error + type EventBus struct + func New(config Config, opts ...Option) (*EventBus, error) + func (d *EventBus) Health() HealthSnapshot + func (d *EventBus) Metrics() MetricsSnapshot + func (d *EventBus) Publish(ctx context.Context, e Event) (PublishResult, error) + func (d *EventBus) Shutdown(ctx context.Context) error + func (d *EventBus) State() State + func (d *EventBus) Subscribe(topic string, handler Handler, opts ...SubscribeOption) (Subscription, error) + type Handler interface + Handle func(context.Context, Event) error + type HandlerFunc func(context.Context, Event) error + func (f HandlerFunc) Handle(ctx context.Context, e Event) error + type HealthSnapshot struct + Reason string + Status HealthStatus + type HealthStatus uint8 + const HealthDraining + const HealthNotReady + const HealthReady + type MetricsSnapshot struct + Accepted uint64 + DeadLettered uint64 + Failed uint64 + InFlight int + MaxLatency time.Duration + Panicked uint64 + Processed uint64 + Published uint64 + QueueDepth int + QueueFull uint64 + Retried uint64 + type Option func(*Config) error + type PublishResult struct + Accepted int + Rejected int + Status DeliveryStatus + type Publisher interface + Publish func(context.Context, Event) (PublishResult, error) + type QueuePolicy uint8 + const QueueBlock + const QueueReject + type State uint8 + const StateClosed + const StateDraining + const StateRunning + func (s State) String() string + type Store interface + Load func(context.Context, string) (StoredEvent, error) + Save func(context.Context, StoredEvent) error + type StoredEvent struct + EncodedPayload []byte + Event Event + type SubscribeConfig struct + Codec Codec + DeadLetterSink DeadLetterSink + ErrorClassifier ErrorClassifier + HandlerTimeout time.Duration + MaxAttempts int + Partitions int + PublishPolicy QueuePolicy + QueueCapacity int + RetryInitialBackoff time.Duration + RetryMaxBackoff time.Duration + type SubscribeOption func(*SubscribeConfig) error + type Subscription interface + Close func() error + ID func() string + Topic func() string v1.0.1 Aug 23, 2026