/**
  * {@inheritDoc}
  */
 public function eventToMessage(Event $event)
 {
     try {
         $msg = $this->prototype ? CustomAmqpMessage::createCopy($this->prototype) : new CustomAmqpMessage();
         $msg->setBody($this->serializer->serializeEvent($event));
         if ($event instanceof PriopritizedEvent) {
             $msg->setPriority($event->getPriority());
         }
         return $msg;
     } catch (SerializerException $e) {
         throw new EventConversionException($event, 'Serialize error', $e);
     }
 }
 /**
  * @test copied message has same properties
  */
 public function copyMessageProperties()
 {
     $message = new AmqpMessageMock();
     $this->assertEquals(CustomAmqpMessage::getMessageProperties($message), CustomAmqpMessage::getMessageProperties(CustomAmqpMessage::createCopy($message)));
 }