AMQPChannel::setReturnCallback PHP Метод

setReturnCallback() публичный Метод

Set callback to process basic.return AMQP server method
public setReturnCallback ( callable $return_callback = null )
$return_callback callable Callback function with all arguments has the following signature: function callback(int $reply_code, string $reply_text, string $exchange, string $routing_key, AMQPBasicProperties $properties, string $body) : bool; and should return boolean false when wait loop should be canceled.
    public function setReturnCallback(callable $return_callback = null)
    {
    }

Usage Example

Пример #1
-1
 /**
  * @inheritdoc
  */
 public function setReturnCallback(callable $returnCallback = null)
 {
     $innerCallback = null;
     if ($returnCallback) {
         $innerCallback = function (int $replyCode, string $replyText, string $exchange, string $routingKey, \AMQPBasicProperties $properties, string $body) use($returnCallback) {
             return $returnCallback($replyCode, $replyText, $exchange, $routingKey, new Envelope($properties), $body);
         };
     }
     $this->channel->setReturnCallback($innerCallback);
 }