protected function initQueue()
{
$this->di->setShared('queue', function () {
$config = $this->getShared('config');
$config = $config->get('beanstalk');
if (!$config->get('enabled')) {
return new DummyServer();
}
if (!($host = $config->get('host'))) {
throw new BeanstalkException('Beanstalk is not configured');
}
return new Beanstalk(['host' => $host]);
});
}