Documentation
¶
Index ¶
Constants ¶
const DefaultNumRetries = 0
DefaultNumRetries is the retry value to use if not set in the context.
const ( // InfiniteRetries is the value to retry without discarding an event. InfiniteRetries = math.MaxInt64 )
Variables ¶
var ErrDiscardEvent = errors.New("drop event from eventbus")
ErrDiscardEvent is used to drop an event manually.
Functions ¶
func NewContextWithNumRetries ¶ added in v0.4.1
NewContextWithNumRetries sets the retries value to use in the context. The number of retries is used to determine how often an event has failed to be handled.
func NumRetriesFromContext ¶ added in v0.4.1
NumRetriesFromContext returns the number of retries from the context, or zero.
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 ¶
func NewEventBus(addr, appID, clientID, exchange, topic string, options ...Option) (*EventBus, error)
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.