github.com/songzhibin97/gkit@v1.2.13/distributed/controller/controller.go (about) 1 package controller 2 3 import ( 4 "context" 5 6 "github.com/songzhibin97/gkit/distributed/task" 7 ) 8 9 type Controller interface { 10 // RegisterTask 注册任务 11 RegisterTask(name ...string) 12 13 // IsRegisterTask 判断任务是否注册 14 IsRegisterTask(name string) bool 15 16 // StartConsuming 开始消费 17 StartConsuming(concurrency int, handler task.Processor) (bool, error) 18 19 // StopConsuming 停止消费 20 StopConsuming() 21 22 // Publish 任务发布 23 Publish(ctx context.Context, t *task.Signature) error 24 25 // GetPendingTasks 获取等待任务 26 GetPendingTasks(queue string) ([]*task.Signature, error) 27 28 // GetDelayedTasks 获取延时任务 29 GetDelayedTasks() ([]*task.Signature, error) 30 31 // SetConsumingQueue 设置消费队列名称 32 SetConsumingQueue(consumingQueue string) 33 34 // SetDelayedQueue 设置延迟队列名称 35 SetDelayedQueue(delayedQueue string) 36 }