Documentation ¶
Index ¶
- func LogDebug(args ...interface{})
- func LogDebugf(format string, args ...interface{})
- func LogError(args ...interface{})
- func LogErrorf(format string, args ...interface{})
- func LogFatal(args ...interface{})
- func LogFatalf(format string, args ...interface{})
- func LogInfo(args ...interface{})
- func LogInfof(format string, args ...interface{})
- func LogWarn(args ...interface{})
- func LogWarnf(format string, args ...interface{})
- func RegisterSubscriber[T any](srv *Server, taskType string, handler func(string, *T) error) error
- func RegisterSubscriberWithCtx[T any](srv *Server, taskType string, handler func(context.Context, string, *T) error) error
- type Binder
- type HandlerData
- type MessageHandler
- type MessageHandlerMap
- type MessagePayload
- type Server
- func (s *Server) Endpoint() (*url.URL, error)
- func (s *Server) Name() string
- func (s *Server) NewPeriodicTask(cronSpec, typeName string, msg broker.Any, opts ...asynq.Option) (string, error)
- func (s *Server) NewTask(typeName string, msg broker.Any, opts ...asynq.Option) error
- func (s *Server) NewWaitResultTask(typeName string, msg broker.Any, opts ...asynq.Option) error
- func (s *Server) QueryPeriodicTaskEntryID(typeName string) string
- func (s *Server) RegisterSubscriber(taskType string, handler MessageHandler, binder Binder) error
- func (s *Server) RegisterSubscriberWithCtx(taskType string, handler func(context.Context, string, MessagePayload) error, ...) error
- func (s *Server) RemoveAllPeriodicTask()
- func (s *Server) RemovePeriodicTask(typeName string) error
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(_ context.Context) error
- type ServerOption
- func WithAddress(addr string) ServerOption
- func WithCodec(c string) ServerOption
- func WithConcurrency(concurrency int) ServerOption
- func WithConfig(c asynq.Config) ServerOption
- func WithDelayedTaskCheckInterval(tm time.Duration) ServerOption
- func WithDialTimeout(timeout time.Duration) ServerOption
- func WithEnableKeepAlive(enable bool) ServerOption
- func WithErrorHandler(fn asynq.ErrorHandler) ServerOption
- func WithGroupGracePeriod(tm time.Duration) ServerOption
- func WithGroupMaxDelay(tm time.Duration) ServerOption
- func WithGroupMaxSize(sz int) ServerOption
- func WithHealthCheckFunc(fn func(error)) ServerOption
- func WithHealthCheckInterval(tm time.Duration) ServerOption
- func WithIsFailure(c asynq.Config) ServerOption
- func WithLocation(name string) ServerOption
- func WithMiddleware(m ...asynq.MiddlewareFunc) ServerOption
- func WithQueues(queues map[string]int) ServerOption
- func WithReadTimeout(timeout time.Duration) ServerOption
- func WithRedisAuth(userName, password string) ServerOption
- func WithRedisDatabase(db int) ServerOption
- func WithRedisPassword(password string) ServerOption
- func WithRedisPoolSize(size int) ServerOption
- func WithRetryDelayFunc(fn asynq.RetryDelayFunc) ServerOption
- func WithStrictPriority(val bool) ServerOption
- func WithTLSConfig(c *tls.Config) ServerOption
- func WithWriteTimeout(timeout time.Duration) ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSubscriber ¶ added in v1.1.0
RegisterSubscriber register task subscriber
Types ¶
type HandlerData ¶ added in v1.1.0
type HandlerData struct { Handler MessageHandler Binder Binder }
type MessageHandler ¶ added in v1.1.0
type MessageHandler func(string, MessagePayload) error
type MessageHandlerMap ¶ added in v1.1.0
type MessageHandlerMap map[string]HandlerData
type MessagePayload ¶ added in v1.1.0
type MessagePayload any
type Server ¶
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) NewPeriodicTask ¶
func (s *Server) NewPeriodicTask(cronSpec, typeName string, msg broker.Any, opts ...asynq.Option) (string, error)
NewPeriodicTask enqueue a new crontab task
func (*Server) NewWaitResultTask ¶ added in v1.2.8
NewWaitResultTask enqueue a new task and wait for the result
func (*Server) QueryPeriodicTaskEntryID ¶ added in v1.2.1
func (*Server) RegisterSubscriber ¶ added in v1.1.0
func (s *Server) RegisterSubscriber(taskType string, handler MessageHandler, binder Binder) error
RegisterSubscriber register task subscriber
func (*Server) RegisterSubscriberWithCtx ¶ added in v1.2.10
func (s *Server) RegisterSubscriberWithCtx(taskType string, handler func(context.Context, string, MessagePayload) error, binder Binder) error
RegisterSubscriberWithCtx register task subscriber with context
func (*Server) RemoveAllPeriodicTask ¶ added in v1.2.1
func (s *Server) RemoveAllPeriodicTask()
func (*Server) RemovePeriodicTask ¶ added in v1.1.0
RemovePeriodicTask remove periodic task
type ServerOption ¶
type ServerOption func(o *Server)
func WithAddress ¶
func WithAddress(addr string) ServerOption
func WithCodec ¶ added in v1.1.0
func WithCodec(c string) ServerOption
func WithConcurrency ¶
func WithConcurrency(concurrency int) ServerOption
func WithConfig ¶ added in v1.2.5
func WithConfig(c asynq.Config) ServerOption
func WithDelayedTaskCheckInterval ¶
func WithDelayedTaskCheckInterval(tm time.Duration) ServerOption
func WithDialTimeout ¶
func WithDialTimeout(timeout time.Duration) ServerOption
func WithEnableKeepAlive ¶ added in v1.1.0
func WithEnableKeepAlive(enable bool) ServerOption
WithEnableKeepAlive enable keep alive
func WithErrorHandler ¶
func WithErrorHandler(fn asynq.ErrorHandler) ServerOption
func WithGroupGracePeriod ¶
func WithGroupGracePeriod(tm time.Duration) ServerOption
func WithGroupMaxDelay ¶
func WithGroupMaxDelay(tm time.Duration) ServerOption
func WithGroupMaxSize ¶
func WithGroupMaxSize(sz int) ServerOption
func WithHealthCheckFunc ¶
func WithHealthCheckFunc(fn func(error)) ServerOption
func WithHealthCheckInterval ¶
func WithHealthCheckInterval(tm time.Duration) ServerOption
func WithIsFailure ¶ added in v1.2.5
func WithIsFailure(c asynq.Config) ServerOption
func WithLocation ¶
func WithLocation(name string) ServerOption
func WithMiddleware ¶
func WithMiddleware(m ...asynq.MiddlewareFunc) ServerOption
func WithQueues ¶
func WithQueues(queues map[string]int) ServerOption
func WithReadTimeout ¶
func WithReadTimeout(timeout time.Duration) ServerOption
func WithRedisAuth ¶
func WithRedisAuth(userName, password string) ServerOption
func WithRedisDatabase ¶
func WithRedisDatabase(db int) ServerOption
func WithRedisPassword ¶ added in v1.1.0
func WithRedisPassword(password string) ServerOption
func WithRedisPoolSize ¶
func WithRedisPoolSize(size int) ServerOption
func WithRetryDelayFunc ¶
func WithRetryDelayFunc(fn asynq.RetryDelayFunc) ServerOption
func WithStrictPriority ¶
func WithStrictPriority(val bool) ServerOption
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ServerOption
func WithWriteTimeout ¶
func WithWriteTimeout(timeout time.Duration) ServerOption
Click to show internal directories.
Click to hide internal directories.