machinery
约 1 分钟阅读
- RichardKnop/machineryGitHubRichardKnop/machineryRichardKnop/machinery 是什么? · 异步任务队列 · Lock - Redis · Broker - AMQP, Redis · ResultBackend - Redis, Memcache, AMQP, MongoDB笔记:machinery 是什么?
- 异步任务队列
- Lock - Redis
- Broker - AMQP, Redis
- ResultBackend - Redis, Memcache, AMQP, MongoDB
func Add(args ...int64) (int64, error) {
sum := int64(0)
for _, arg := range args {
sum += arg
}
return sum, nil
}
func Multiply(args ...int64) (int64, error) {
sum := int64(1)
for _, arg := range args {
sum *= arg
}
return sum, nil
}
func main(){
server.RegisterTasks(map[string]interface{}{
"add": Add,
"multiply": Multiply,
})
signature := &tasks.Signature{
Name: "add",
Args: []tasks.Arg{
{
Type: "int64",
Value: 1,
},
{
Type: "int64",
Value: 1,
},
},
}
// 触发任务
asyncResult, err := server.SendTask(signature)
}关联信息
反向链接、本文链接的其他页面和外部资料。
参考资料
GitHub1 条
- RichardKnop/machinerygithub.com/RichardKnop/machinery