backburner
backburner copied to clipboard
Beanstalk failover
The beanstalk-client gem allows you to define multiple beanstalk servers, but I don't see how that works with backburner's configure block.
This way the workers could listen to the same queue on multiple beanstalkd servers and if job enqueuing fails, backburner should try another server in the pool.
You can actually specify multiple beanstalk servers:
config.beanstalk_url = "beanstalk://127.0.0.1, beanstalk://xxx.x.x.x:3456, beanstalk://test.foo.com:6785"
Should work with the existing gem. Also I probably should patch it to allow an array passed in as well.
This has been fixed now, so even this is supported:
config.beanstalk_url = ["beanstalk://127.0.0.1", "beanstalk://xxx.x.x.x:3456", "beanstalk://test.foo.com:6785"]
I don't think it failovers properly.
config.beanstalk_url = ["beanstalk://queue1.vms", "beanstalk://queue2.vms"]
When both are responding, all is good:
>> Backburner.enqueue TestJob, 'hello'
=> true
Kill beanstalkd on queue2 and
>> Backburner.enqueue TestJob, 'hello'
Beaneater::NotConnected: Could not connect to 'queue2.vms:11300'
Hey, shouldn't this be reopened? I am seeing the same behavior as @kke here.
Re-opened