Exemple #1
0
 /**
  *
  */
 public function testTimeWaits()
 {
     $this->resultStore->setWait(4);
     $task = $this->rhubarb->sendTask('test.task', array(2, 2));
     $this->resultStore->setNextResult($this->getSuccesfulResult('SUCCESS', $task->getId()));
     $task->delay();
     $this->assertEquals(2105, $task->get());
 }
Exemple #2
0
 /**
  * @param string      $name
  * @param array       $args
  * @param Rhubarb     $rhubarb
  * @param null|string $id
  */
 public function __construct($name, $args = array(), Rhubarb $rhubarb, $id = null)
 {
     if (!$id) {
         $id = (string) Uuid::uuid1();
     }
     $rhubarbOptions = $rhubarb->getOptions();
     $this->setId($id)->setArgs($args)->setName($name)->setRhubarb($rhubarb);
     $this->message = new Message();
     if (isset($rhubarbOptions['broker']['options']['queue']['name'])) {
         $this->message->setQueue($rhubarbOptions['broker']['options']['queue']['name']);
     }
     if (isset($rhubarbOptions['broker']['options']['queue']['arguments'])) {
         $this->message->setPropQueueArgs($rhubarbOptions['broker']['options']['queue']['arguments']);
     }
     if (isset($rhubarbOptions['broker']['options']['exchange'])) {
         $this->message->setPropExchange($rhubarbOptions['broker']['options']['exchange']);
     }
 }