Documentation ¶
Index ¶
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 is a NATS Jetstream event bus that delegates handling of published events to all matching registered handlers.
func NewEventBus ¶
NewEventBus creates an EventBus, with optional settings.
func (*EventBus) AddHandler ¶
func (b *EventBus) AddHandler(ctx context.Context, m eh.EventMatcher, h eh.EventHandler) error
AddHandler implements the AddHandler method of the eventhorizon.EventBus interface.
func (*EventBus) Close ¶ added in v0.14.8
Close implements the Close method of the eventhorizon.EventBus interface.
func (*EventBus) Errors ¶
Errors implements the Errors method of the eventhorizon.EventBus interface.
func (*EventBus) HandleEvent ¶
HandleEvent implements the HandleEvent method of the eventhorizon.EventHandler interface.
func (*EventBus) HandlerType ¶
func (b *EventBus) HandlerType() eh.EventHandlerType
HandlerType implements the HandlerType method of the eventhorizon.EventHandler interface.
type Option ¶
Option is an option setter used to configure creation.
func WithCodec ¶
func WithCodec(codec eh.EventCodec) Option
WithCodec uses the specified codec for encoding events.
func WithNATSOptions ¶
func WithNATSOptions(opts ...nats.Option) Option
WithNATSOptions adds the NATS options to the underlying client.
func WithStreamConfig ¶ added in v0.16.0
func WithStreamConfig(opts *nats.StreamConfig) Option
WithStreamConfig can customize the config for created NATS JetStream.