Documentation ¶
Index ¶
- Variables
- func ParseRedisURI(connURI string) (asynq.RedisConnOpt, error)
- func RedisOptFromCache() (asynq.RedisConnOpt, error)
- func Send(task *Task, options ...asynq.Option) (*asynq.TaskInfo, error)
- func SendBy(typeName string, payload []byte, options ...asynq.Option) (*asynq.TaskInfo, error)
- func SendJSON(typeName string, payload interface{}, options ...asynq.Option) (*asynq.TaskInfo, error)
- func StartWorker(configs ...*asynq.Config) error
- func WorkerHandle(pattern string, handler asynq.Handler) error
- func WorkerHandleFunc(pattern string, handler func(context.Context, *asynq.Task) error) 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) SendJSON(typeName string, payload interface{}, 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 RedisClientOpt
- type RedisClusterClientOpt
- type RedisFailoverClientOpt
- 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)
func RedisOptFromCache ¶
func RedisOptFromCache() (asynq.RedisConnOpt, error)
func StartWorker ¶
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
type RedisClientOpt ¶
type RedisClientOpt = asynq.RedisClientOpt
type RedisClusterClientOpt ¶
type RedisClusterClientOpt = asynq.RedisClusterClientOpt
type RedisFailoverClientOpt ¶
type RedisFailoverClientOpt = asynq.RedisFailoverClientOpt
Click to show internal directories.
Click to hide internal directories.