Versions in this module Expand all Collapse all v1 v1.0.0 Jun 16, 2026 Changes in this version + var ErrBackpressure = errors.New("msgbus backpressure") + var ErrComponentFaulted = errors.New("component faulted") + var ErrEndpointNotFound = errors.New("endpoint not found") + type Clock interface + After func(time.Duration) <-chan time.Time + Now func() time.Time + type Component struct + func NewComponent(id string, hooks ComponentHooks) *Component + func (c *Component) Degrade(err error) + func (c *Component) Fault(err error) + func (c *Component) Health() Health + func (c *Component) Kill(ctx context.Context) error + func (c *Component) Start(ctx context.Context) error + func (c *Component) State() ComponentState + func (c *Component) Stop(ctx context.Context) error + type ComponentHooks struct + Kill func(context.Context) error + Start func(context.Context) error + Stop func(context.Context) error + type ComponentState string + const ComponentStateDegraded + const ComponentStateFaulted + const ComponentStateInitialized + const ComponentStateRunning + const ComponentStateStarting + const ComponentStateStopped + const ComponentStateStopping + type EndpointHandler func(context.Context, Request) (Response, error) + type Envelope struct + CorrelationID string + Message any + Timestamp time.Time + Topic string + type Health struct + ID string + LastError string + State ComponentState + type LiveClock struct + func (LiveClock) After(d time.Duration) <-chan time.Time + func (LiveClock) Now() time.Time + type MsgBus struct + func NewMsgBus(cfg MsgBusConfig) *MsgBus + func (b *MsgBus) Publish(ctx context.Context, topic string, message any) error + func (b *MsgBus) RegisterEndpoint(endpoint string, handler EndpointHandler) + func (b *MsgBus) Request(ctx context.Context, endpoint string, payload any) (Response, error) + func (b *MsgBus) Stats() MsgBusStats + func (b *MsgBus) Subscribe(topic string, buffer int) Subscription + type MsgBusConfig struct + Clock Clock + DefaultBuffer int + type MsgBusStats struct + Dropped int64 + Published int64 + type Request struct + CorrelationID string + Endpoint string + Payload any + Timestamp time.Time + type Response struct + CorrelationID string + Payload any + type Subscription interface + C func() <-chan Envelope + Close func() error + type TestClock struct + func NewTestClock(start time.Time) *TestClock + func (c *TestClock) Advance(d time.Duration) + func (c *TestClock) After(d time.Duration) <-chan time.Time + func (c *TestClock) Now() time.Time