public function testProcessClosure() { $command = 'ClosureExample'; $config = array('command' => function () { echo "I'm a function!\n"; return true; }, 'schedule' => '0 * * * *', 'output' => 'logs/closure.log', 'enabled' => true); $helper = new Helper(); $config['command'] = $helper->closureToString($config['command']); $message = $this->prepareMessage(); $message->body = serialize(array('cmd' => $command, 'config' => $config)); $worker = new Job('localhost'); $worker->setJobFactory($this->prepareJobFactory($command, $config)); $worker->process($message); }
<?php require_once __DIR__ . '/../vendor/autoload.php'; use Havlicek\JobbyRabbitMq\Job; // Run command "vagrant up" first // Create new instance of worker $job = new Job('192.168.33.10', 5672); // Wait for incoming connection and process it $job->listen();