Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler is a event scheduler that periodically inserts events into the event stream. It uses the cron syntax from https://github.com/gorhill/cronexpr.
func NewMiddleware ¶
func NewMiddleware(ctx context.Context) (eh.EventHandlerMiddleware, *Scheduler)
NewMiddleware creates a new scheduler middleware that runs until the context is canceled.
func (*Scheduler) ScheduleEvent ¶
func (s *Scheduler) ScheduleEvent(ctx context.Context, cronLine string, eventFunc func(time.Time) eh.Event) error
ScheduleEvent schedules an event to be sent on regular intervals, using a line in the crontab format to setup the timing. The eventFunc should create the event to send given the triggered time as input. Cancelling the context will stop the triggering of more events.
Click to show internal directories.
Click to hide internal directories.