goasynq

package
v1.2.112 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

轻量级队列基于redis

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelClient added in v1.2.108

func DelClient(names ...string)

func DelServer added in v1.2.108

func DelServer(names ...string)

func InitClient

func InitClient(configs ...ClientConfig) error

client

func InitServer

func InitServer(configs ...ServerConfig) error

server

Types

type ClientConfig

type ClientConfig struct {
	goredis.Config
	PoolSize int
}

type GoAsynqClient

type GoAsynqClient struct {
	Client *asynq.Client
}

func DefaultClient

func DefaultClient() *GoAsynqClient

func GetClient

func GetClient(names ...string) *GoAsynqClient

func NewClient

func NewClient(config ClientConfig) *GoAsynqClient

func (*GoAsynqClient) Close

func (c *GoAsynqClient) Close() error

func (*GoAsynqClient) Enqueue

func (c *GoAsynqClient) Enqueue(taskTypeTopic string, payload any, opts ...asynq.Option) (*asynq.TaskInfo, error)

func (*GoAsynqClient) NewTask

func (c *GoAsynqClient) NewTask(taskTypeTopic string, payload any, opts ...asynq.Option) (*asynq.Task, error)

type GoAsynqServer

type GoAsynqServer struct {
	ServeMux *asynq.ServeMux
	Server   *asynq.Server
}

func DefaultServer

func DefaultServer() *GoAsynqServer

func GetServer

func GetServer(names ...string) *GoAsynqServer

func RunServer

func RunServer(config ServerConfig) *GoAsynqServer

func (*GoAsynqServer) Handle

func (s *GoAsynqServer) Handle(taskTypeTopic string, handler asynq.Handler)

func (*GoAsynqServer) HandleFunc

func (s *GoAsynqServer) HandleFunc(taskTypeTopic string, handler func(context.Context, *asynq.Task) error)

func (*GoAsynqServer) Stop

func (s *GoAsynqServer) Stop()

type ServerConfig

type ServerConfig struct {
	goredis.Config
	PoolSize    int
	Concurrency int //default 10 指定要使用的并发工作线程数量
	Queues      map[string]int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL