/** * @throws AMQPServerExchangeException|AMQPServerConnectionException * @return AMQPChannelInterface **/ public function basicPublish($exchange, $routingKey, AMQPOutgoingMessage $msg) { try { $obj = $this->lookupExchange($exchange); $result = $obj->publish($msg->getBody(), $routingKey, $msg->getBitmask(new AMQPPeclOutgoingMessageBitmask()), $msg->getProperties()); } catch (AMQPExchangeException $e) { throw new AMQPServerException($e->getMessage(), $e->getCode(), $e); } $this->checkCommandResult($result, "Could not publish to exchange"); return $this; }