/**
  * {@inheritDoc}
  */
 public function publish(MessagePublication $publication, $exchange, $routingKey = '')
 {
     try {
         $this->getChannel()->basic_publish(AmqpMessageUtils::createAmqpLibMessage($publication->getMessage(), $publication->isPersistent()), $exchange, $routingKey, $publication->isMandatory(), $publication->isImmediate());
     } catch (\Exception $e) {
         throw new DriverException('Basic publish error', $e);
     }
 }
 /**
  * {@inheritDoc}
  */
 public function publish(MessagePublication $publication, $exchange, $routingKey = '')
 {
     $flags = AMQP_NOPARAM;
     if ($publication->isImmediate()) {
         $flags |= AMQP_IMMEDIATE;
     }
     if ($publication->isMandatory()) {
         $flags |= AMQP_MANDATORY;
     }
     $this->getExchange($exchange)->publish($publication->getMessage()->getBody(), $routingKey, $flags, PeclMessageUtils::getPublishAttributes($publication->getMessage()));
 }