add backend
parent
0fff77ab9b
commit
4132d48e71
|
@ -65,7 +65,7 @@ func main() {
|
|||
}
|
||||
|
||||
func startServer() (*machinery.Server, error) {
|
||||
cnf := &config.Config{
|
||||
conf := &config.Config{
|
||||
DefaultQueue: "machinery_tasks",
|
||||
Broker: "http://127.0.0.1:2379",
|
||||
ResultBackend: "http://127.0.0.1:2379",
|
||||
|
@ -76,22 +76,23 @@ func startServer() (*machinery.Server, error) {
|
|||
ctx := context.Background()
|
||||
// Create server instance
|
||||
// broker := redisbroker.NewGR(cnf, []string{"localhost:6379"}, 1)
|
||||
broker, err := etcdbroker.New(ctx, cnf)
|
||||
broker, err := etcdbroker.New(ctx, conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// backend := redisbackend.NewGR(cnf, []string{"localhost:6379"}, 3)
|
||||
backend, err := etcdbackend.New(ctx, conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// lock := redislock.New(cnf, []string{"localhost:6379"}, 3, 2)
|
||||
lock, err := etcdlock.New(ctx, cnf, 3)
|
||||
lock, err := etcdlock.New(ctx, conf, 3)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// backend := redisbackend.NewGR(cnf, []string{"localhost:6379"}, 3)
|
||||
backend, err := etcdbackend.New(ctx, cnf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
server := machinery.NewServer(cnf, broker, backend, lock)
|
||||
server := machinery.NewServer(conf, broker, backend, lock)
|
||||
|
||||
// Register tasks
|
||||
tasksMap := map[string]interface{}{
|
||||
|
|
Loading…
Reference in New Issue