public function test_toMessageInterface_withProperRpcRequestTypeAMQMessage_returnsRpcRequestMessage()
 {
     $adaptor = new PhpAmqpLibMessageAdaptor();
     $amqpMessage = new AMQPMessage();
     $amqpMessage->set(MessageInterface::PROPERTY_TYPE, MessageInterface::TYPE_RPC_REQUEST);
     $amqpMessage->set(MessageInterface::PROPERTY_CONTENT_TYPE, MessageInterface::CONTENT_TYPE_PLAIN_TEXT);
     $message = $adaptor->toMessageInterface($amqpMessage);
     $this->assertTrue($message instanceof RpcRequestMessage, 'Returned value is not an instance of RpcRequestMessage');
 }
 /**
  * @param MessageInterface $message
  * @param string $exchangeName Destination xchange name.
  * @param string $routingKeyOrQueueName Routing key (if xchange is set) or the destination
  *     queue name.
  *
  * @return void
  */
 public function basicPublish(MessageInterface $message, $exchangeName = '', $routingKeyOrQueueName = '')
 {
     /** @var AMQPMessage $amqpMessage */
     $amqpMessage = $this->messageAdaptor->fromMessageInterface($message);
     $currentMessageProperties = $amqpMessage->get_properties();
     if (!isset($currentMessageProperties['timestamp'])) {
         $amqpMessage->set('timestamp', time());
     }
     $this->channel->basic_publish($amqpMessage, $exchangeName, $routingKeyOrQueueName);
     $this->logger->notice('Message published!', ['body' => $amqpMessage->body, 'properties' => $amqpMessage->get_properties()]);
 }