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 local event bus that delegates handling of published events to all matching registered handlers, in order of registration.
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) 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 WithAutoCreateTopic ¶
WithAutoCreateTopic specifies whether the event bus should automatically create the topic if it does not exist.
Defaults to: true
func WithCodec ¶
func WithCodec(codec eh.EventCodec) Option
WithCodec uses the specified codec for encoding events.
func WithDialer ¶ added in v0.2.0
func WithDialer(dialer *kafka.Dialer) Option
WithDialer specifies a Kafka dialer to use when creating clients, readers, and writers.
Defaults to: kafka.DefaultDialer
func WithStartOffset ¶
WithStartOffset sets the consumer group's offset to start at Defaults to: LastOffset Per the kafka client documentation
StartOffset determines from whence the consumer group should begin consuming when it finds a partition without a committed offset. If non-zero, it must be set to one of FirstOffset or LastOffset.
func WithTopic ¶
WithTopic uses the specified topic for the event bus topic name.
Defaults to: appID + "_events"
func WithTopicPartitions ¶
WithTopicPartitions uses the specified number of partitions when creating the event bus topic.
This option is ignored if the topic already exists or if automatic topic creation is disabled.
Defaults to: 5