Documentation ¶
Index ¶
- Variables
- func ParseRedisURI(connURI string) (asynq.RedisConnOpt, error)
- type Asynq
- func (a *Asynq) Client() *asynq.Client
- func (a *Asynq) Close() error
- func (a *Asynq) Handle(pattern string, handler asynq.Handler) *Asynq
- func (a *Asynq) HandleFunc(pattern string, handler func(context.Context, *asynq.Task) error) *Asynq
- func (a *Asynq) Send(task *asynq.Task, options ...asynq.Option) (*asynq.TaskInfo, error)
- func (a *Asynq) SendBy(typeName string, payload []byte, options ...asynq.Option) (*asynq.TaskInfo, error)
- func (a *Asynq) ServeMux() *asynq.ServeMux
- func (a *Asynq) Server() *asynq.Server
- func (a *Asynq) SetRedisOptions(redisOptions asynq.RedisConnOpt) error
- func (a *Asynq) StartWorker(configs ...*asynq.Config) error
- func (a *Asynq) Use(mws ...asynq.MiddlewareFunc) *Asynq
- type Task
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultWorkerConfig = asynq.Config{ Concurrency: 10, Queues: map[string]int{ "critical": 6, "default": 3, "low": 1, }, }
Functions ¶
func ParseRedisURI ¶
func ParseRedisURI(connURI string) (asynq.RedisConnOpt, error)
Types ¶
type Asynq ¶
type Asynq struct {
// contains filtered or unexported fields
}
func (*Asynq) HandleFunc ¶
func (*Asynq) Send ¶
Send Create a task with task type and payload task := asynq.NewTask("send_welcome_email", map[string]interface{}{"user_id": 42}) options: - asynq.MaxRetry - asynq.Queue - 指定队列名称 - asynq.Timeout - asynq.Deadline - asynq.Unique - errors.Is(err, asynq.ErrDuplicateTask) - asynq.ProcessAt - 指定处理时间 - asynq.ProcessIn - 指定延后时长
func (*Asynq) SetRedisOptions ¶
func (a *Asynq) SetRedisOptions(redisOptions asynq.RedisConnOpt) error
Click to show internal directories.
Click to hide internal directories.