Documentation
¶
Index ¶
- type EventBus
- func (w *EventBus) Close(ctx context.Context) error
- func (w *EventBus) Publish(ctx context.Context, topic string, payload []byte) error
- func (w *EventBus) Subscribe(ctx context.Context, topic string, handler modulex.EventHandler) error
- func (w *EventBus) SubscribeWithOptions(ctx context.Context, topic string, handler modulex.EventHandler, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus implements modulex.EventBus using Watermill's Channel.
func NewEventBus ¶
NewEventBus creates a configured in-memory Channel PubSub.
func (*EventBus) Close ¶
Close cancels all active subscriptions, waits for running handlers to exit, and shuts down the underlying Channel.
func (*EventBus) Publish ¶
Publish generates a Watermill-compatible message, propagates context, and sends it.
func (*EventBus) SubscribeWithOptions ¶ added in v0.8.0
func (w *EventBus) SubscribeWithOptions(ctx context.Context, topic string, handler modulex.EventHandler, options workerpool.Options) error
SubscribeWithOptions subscribes with an opt-in bounded processor. Handler errors retain Watermill's existing acknowledge-and-log policy. Messages are acknowledged only after the handler returns. Processing order is not guaranteed when Workers is greater than one.
Click to show internal directories.
Click to hide internal directories.