Documentation ¶
Index ¶
- Variables
- func Backend(_ context.Context, opts ...neoq.ConfigOption) (backend neoq.Neoq, err error)
- func WithAddr(addr string) neoq.ConfigOption
- func WithConcurrency(concurrency int) neoq.ConfigOption
- func WithPassword(password string) neoq.ConfigOption
- func WithShutdownTimeout(timeout time.Duration) neoq.ConfigOption
- type RedisBackend
- func (b *RedisBackend) Enqueue(ctx context.Context, job *jobs.Job) (jobID string, err error)
- func (b *RedisBackend) SetLogger(logger logging.Logger)
- func (b *RedisBackend) Shutdown(ctx context.Context)
- func (b *RedisBackend) Start(_ context.Context, h handler.Handler) (err error)
- func (b *RedisBackend) StartCron(ctx context.Context, cronSpec string, h handler.Handler) (err error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAddr = errors.New("invalid connecton string: see documentation for valid connection strings")
ErrInvalidAddr indicates that the provided address is not a valid redis connection string
Functions ¶
func Backend ¶
Backend is a neoq.BackendInitializer that initializes a new Redis-backed neoq backend
func WithAddr ¶
func WithAddr(addr string) neoq.ConfigOption
WithAddr configures neoq to connect to Redis with the given address
func WithConcurrency ¶
func WithConcurrency(concurrency int) neoq.ConfigOption
WithConcurrency configures the number of workers available to process jobs across all queues
func WithPassword ¶
func WithPassword(password string) neoq.ConfigOption
WithPassword configures neoq to connect to Redis with the given password
func WithShutdownTimeout ¶
func WithShutdownTimeout(timeout time.Duration) neoq.ConfigOption
WithShutdownTimeout specifies the duration to wait to let workers finish their tasks before forcing them to abort durning Shutdown()
If unset or zero, default timeout of 8 seconds is used.
Types ¶
type RedisBackend ¶ added in v0.16.0
RedisBackend is a Redis-backed neoq backend nolint: revive
func (*RedisBackend) SetLogger ¶ added in v0.16.0
func (b *RedisBackend) SetLogger(logger logging.Logger)
SetLogger sets this backend's logger
func (*RedisBackend) Shutdown ¶ added in v0.16.0
func (b *RedisBackend) Shutdown(ctx context.Context)
Shutdown halts the worker
func (*RedisBackend) Start ¶ added in v0.16.0
Start starts processing jobs with the specified queue and handler
func (*RedisBackend) StartCron ¶ added in v0.16.0
func (b *RedisBackend) StartCron(ctx context.Context, cronSpec string, h handler.Handler) (err error)
StartCron starts processing jobs with the specified cron schedule and handler
See: https://pkg.go.dev/github.com/robfig/cron?#hdr-CRON_Expression_Format for details on the cron spec format