I have set my config to use my local beanstalkd server:
'beanstalkd' => array(
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
)
How do I push jobs to another beanstalkd server?
Queue::push(function($job)
{
// This pushes to local beanstalkd
});
Queue::pushToRemoteBeanstalkdInstance(function($job)
{
// ?
});
You have to make an extra config in the queue config file, so it will look something like this:
'connections' => array(
'beanstalkd' => array(
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
),
'beanstalkd_remote' => array(
'driver' => 'beanstalkd',
'host' => 'remotehost',
'queue' => 'default',
)
)
If the default is set to "beanstalkd" you can keep calling it the normal way.
If you want to use the remote queue simply define the connection in the call like:
Queue::connection('beanstalkd_remote')->push(function($job)
{
// This pushes to remote beanstalkd
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With