Example #1
0
 /**
  * {@inheritdoc}
  */
 public function send(JobInterface $job)
 {
     $this->socket->send($job->toJson());
     $response = $this->socket->recv();
     try {
         $acknowledgement = AcknowledgementFactory::fromJson($response);
     } catch (RuntimeException $e) {
         throw new ClientRequestException('Message was not understood by gloubster server', $response);
     }
     if (!$acknowledgement instanceof JobAcknowledgement) {
         throw new ClientNotAcknowledgedRequestException('Message was not acknowledge by gloubster server', $response, $acknowledgement);
     }
     return $acknowledgement;
 }
Example #2
0
 /**
  * @expectedException Gloubster\Exception\RuntimeException
  */
 public function testFromJsonFailsWithMissingType()
 {
     Factory::fromJson(json_encode(array('name' => 'hello')));
 }