Versions in this module Expand all Collapse all v1 v1.0.0 May 31, 2023 Changes in this version + const EventStatusCompleted + const EventStatusDequeue + const EventStatusFailed + const EventStatusPending + const EventStatusRunning + var ErrEventNotFound = fmt.Errorf("event not found") + type ErrEventRunningDelayed struct + func NewErrEventRunningDelayed(message string, delay time.Duration) ErrEventRunningDelayed + func (e ErrEventRunningDelayed) Delay() time.Duration + func (e ErrEventRunningDelayed) Error() string + type Event struct + CreatedAt time.Time + EventID string + Payload string + RetryCount int + ScheduledAt time.Time + Status string + Type string + UpdatedAt time.Time + type EventBus interface + Close func(ctx context.Context) error + Publish func(ctx context.Context, event IEvent) error + Start func(ctx context.Context, workers int) error + Subscribe func(eventType string, handler EventHandler) + func NewEventBus(repository EventRepository, options ...Option) (EventBus, error) + type EventHandler interface + Handle func(ctx context.Context, payload string) error + type EventHandlerFunc func(ctx context.Context, payload string) error + func (f EventHandlerFunc) Handle(ctx context.Context, payload string) error + type EventRepository interface + Get func(ctx context.Context, id string) (*Event, error) + ListAndLockUnfinishedEvents func(ctx context.Context, limit int, eventTypes []string) ([]*Event, error) + Save func(ctx context.Context, event *Event) error + Search func(ctx context.Context, filter *Filter) ([]*Event, error) + UpdateRetryCount func(ctx context.Context, event *Event, retryCount int) error + UpdateStatus func(ctx context.Context, event *Event, status string) error + type Filter struct + Payload string + Status []string + Type []string + type IEvent interface + Delay func() time.Duration + EventType func() string + Payload func() []byte + type Impl struct + func (engine *Impl) Close(ctx context.Context) error + func (engine *Impl) Publish(ctx context.Context, iEvent IEvent) error + func (engine *Impl) Start(ctx context.Context, workers int) error + func (engine *Impl) Subscribe(eventType string, handler EventHandler) + type Option func(impl *Impl) + func WithBatchSize(batchSize int) Option + func WithMaxRetries(retry int) Option + func WithSyncPeriod(duration time.Duration) Option