/**
  * Publishes a message
  *
  * @param AMQPMessage $msg
  * @param string $exchange
  * @param string $routing_key
  * @param bool $mandatory
  * @param bool $immediate
  * @param null $ticket
  */
 public function basic_publish($msg, $exchange = '', $routing_key = '', $mandatory = false, $immediate = false, $ticket = null)
 {
     $flags = AMQP_NOPARAM;
     $flags += $mandatory ? AMQP_MANDATORY : 0;
     $flags += $immediate ? AMQP_IMMEDIATE : 0;
     $xchange = new \AMQPExchange($this->channel);
     $xchange->setName($exchange);
     $xchange->publish($msg->body, $routing_key, $flags, $msg->get_properties());
 }
 /**
  * Publishes a message
  *
  * @param AMQPMessage $msg
  * @param string $exchange
  * @param string $routing_key
  * @param bool $mandatory
  * @param bool $immediate
  * @param null $ticket
  */
 public function basic_publish($msg, $exchange = '', $routing_key = '', $mandatory = false, $immediate = false, $ticket = null)
 {
     $message = new \PhpAmqpLib\Message\AMQPMessage($msg->body, $msg->get_properties());
     $this->channel->basic_publish($message, $exchange, $routing_key, $mandatory, $immediate, $ticket);
 }