/**
  * {@inheritDoc}
  */
 public function messageToEvent(AmqpMessage $message)
 {
     try {
         return $this->serializer->deserializeEvent($message->getBody());
     } catch (SerializerException $e) {
         throw new MessageConversionException($message, 'Deserialize error', $e);
     }
 }
 public static function createAmqpLibMessage(AmqpMessage $message, $persistent = true)
 {
     $amqpLibMessage = new AmqpLibMessage($message->getBody());
     foreach (self::$PROPERTY_MAP as $name => $amqpLibName) {
         $value = $message->{'get' . ucfirst($name)}();
         if ($value !== null) {
             $amqpLibMessage->set($amqpLibName, $value);
         }
     }
     $deliveryMode = $persistent ? self::DELIVERY_MODE_PERSISTENT : self::DELIVERY_MODE_NON_PERSISTENT;
     $amqpLibMessage->set('delivery_mode', $deliveryMode);
     return $amqpLibMessage;
 }