コード例 #1
0
ファイル: RunWorker.php プロジェクト: gloubster/worker
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $conn = AMQPFactory::createAMQPLibConnection($this->conf);
     $type = $input->getArgument('type');
     $id = $input->getArgument('id') ?: $this->generateId($type);
     $output->writeln(sprintf("Running %s worker #%s ...", $type, $id));
     $worker = Factory::createWorker($type, $id, $conn, $this->conf, new TemporaryFilesystem(), $this->logger);
     if (0 < (int) $input->getOption('timeout')) {
         $worker->setTimeout($input->getOption('timeout'));
     }
     $worker->run($input->getOption('iterations'));
 }
コード例 #2
0
ファイル: FactoryTest.php プロジェクト: gloubster/worker
 /**
  * @covers Gloubster\AMQP\Factory::createAMQPLibConnection
  */
 public function testCreateConnectedConnection()
 {
     $connection = Factory::createAMQPLibConnection($this->configuration);
     $this->assertInstanceOf('PhpAmqpLib\\Connection\\AMQPConnection', $connection);
 }