/**
  * @param callable $callback
  *
  * @return void
  */
 protected function consumeMessage(callable $callback)
 {
     $this->channelFactory->fanout($this->exchange, $this->channel)->then(function ($r) use($callback) {
         /** @var Channel $channel */
         $channel = $r[0];
         return $channel->consume(function (Message $message) use($callback) {
             $data = json_decode($message->content, true);
             $callback($this->serializer->deserialize(null, $data));
         }, $this->channel, '', false, true);
     }, function (Exception $exception) {
         $this->loop->stop();
         throw new AsyncMessagingException(sprintf('Could not consume message: %s on line %s in file %s', $exception->getMessage(), $exception->getLine(), $exception->getFile()), 0, $exception);
     });
 }
 /**
  * @param array $serializedObject
  * @return object
  */
 public function deserialize(array $serializedObject)
 {
     return $this->serializer->deserialize($serializedObject['class'], $serializedObject['payload']);
 }
 /**
  * @param array $serializedObject
  *
  * @return object
  */
 public function deserialize(array $serializedObject)
 {
     $decryptedObject = $this->encryptor->decrypt($serializedObject['payload']);
     return $this->serializer->deserialize($serializedObject['class'], $decryptedObject);
 }