Используем вызов методов AMQP либы через ... оператор

This commit is contained in:
ErickSkrauch 2016-11-26 14:09:15 +03:00
parent 999f8237e4
commit e6fa0fe6f3

View File

@ -111,8 +111,8 @@ class Component extends \yii\base\Component {
public function sendToExchange($exchangeName, $routingKey, $message, $exchangeArgs = [], $publishArgs = []) {
$message = $this->prepareMessage($message);
$channel = $this->getChannel();
call_user_func_array([$channel, 'exchange_declare'], $this->prepareExchangeArgs($exchangeName, $exchangeArgs));
call_user_func_array([$channel, 'basic_publish'], $this->preparePublishArgs($message, $exchangeName, $routingKey, $publishArgs));
$channel->exchange_declare(...$this->prepareExchangeArgs($exchangeName, $exchangeArgs));
$channel->basic_publish(...$this->preparePublishArgs($message, $exchangeName, $routingKey, $publishArgs));
}
/**