RichardKnop / machinery

Machinery is an asynchronous task queue/job queue based on distributed message passing.
Mozilla Public License 2.0
7.57k stars 917 forks source link

"Result backend required" error on mongo #422

Open siredwin opened 5 years ago

siredwin commented 5 years ago

I have the correct settings from yml. The server even starts with the following message:

/tmp/APIgo

GOROOT=/usr/local/go GOPATH=/home/edwin/IdeaProjects/gowork:/usr/local/go/src /usr/local/go/bin/go build -o /tmp/APIgo github.com/siredwin/zipperapi INFO: 2019/05/30 15:22:32 file.go:19 Successfully loaded config from file config.yml INFO: 2019/05/30 15:22:32 worker.go:46 Launching a worker with the following settings: INFO: 2019/05/30 15:22:32 worker.go:47 - Broker: amqp://guest:guest@localhost:5672 INFO: 2019/05/30 15:22:32 worker.go:49 - DefaultQueue: machinery_tasks INFO: 2019/05/30 15:22:32 worker.go:53 - ResultBackend: mongodb://localhost:27017/taskresults INFO: 2019/05/30 15:22:32 worker.go:55 - AMQP: machinery_exchange INFO: 2019/05/30 15:22:32 worker.go:56 - Exchange: machinery_exchange INFO: 2019/05/30 15:22:32 worker.go:57 - ExchangeType: direct INFO: 2019/05/30 15:22:32 worker.go:58 - BindingKey: machinery_task INFO: 2019/05/30 15:22:32 worker.go:59 - PrefetchCount: 30 INFO: 2019/05/30 15:22:32 amqp.go:95 [*] Waiting for messages. To exit press CTRL+C

What is going on? Redis seems to work fine from the same YML. The mongo examples seem to work just fine.

siredwin commented 5 years ago

Temporary Fix! I just checked out version 1.5.5 and it works. Something is wrong with the Mongo Fixes!

RichardKnop commented 5 years ago

@siredwin Can you try defining the database in mongodb config: https://github.com/RichardKnop/machinery/blob/master/v1/config/config.go#L63

Instead in the connection string? I think the new mongodb driver works differently compared to old mgo driver (not maintained anymore). It might also be required to define username/password in connection string.

It would be better to use latest version if you can make it work.

siredwin commented 5 years ago

I will probably use the old version to finish this update, then look in to the new official mongo version.

RichardKnop commented 5 years ago

Sounds good, if you also want to contribute to mongodb backend in the codebase, feel free. It could use some improvements. @siredwin

siredwin commented 5 years ago

I realized that the config was not done for the new version. But the old connection string still works on the new version(not sure if the database needs to be separate, or can be parsed). So it should not be hard to implement it. You should probably leave the old mongo in there and add a new backend for the official mongo, then phase it out when fully implemented.