AMQPExchange::setArgument PHP Метод

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

Set the value for the given key.
public setArgument ( string $key, string | integer $value ) : boolean
$key string Name of the argument to set.
$value string | integer Value of the argument to set.
Результат boolean TRUE on success or FALSE on failure.
    public function setArgument($key, $value)
    {
    }

Usage Example

Пример #1
0
$user = new User('Sasha', 'kalendarev');
$user->setPswd(777);
//print serialize($user);
// print_r( get_loaded_extensions() );
$cnn = new AMQPConnection(['port' => 5677]);
// $cnn = new AMQPConnection();
if (!$cnn) {
    die("AMQP connection fail");
}
echo "------  connect ...  --------\n";
$ret = $cnn->connect();
echo "------  open Channel  --------\n";
$ch = new AMQPChannel($cnn);
echo "------  open Ok  --------\n";
$ex = new AMQPExchange($ch);
echo "------  exchange Ok  --------\n";
// $cnn->disconnect(AMQP_NOPARAM);
$ex->setName('test_e');
define('PLAIN', 'text/plain');
define('JSON', 'text/json');
$ex->setArgument('content_type', PLAIN);
$ex->setArgument('user_id', 'guest');
$ex->setArgument('timestamp', time());
$headers = ['sss' => 'asd', 'xxx' => 321];
echo "------  publish ...  --------\n";
$ex->publish("*******", 'kkk', AMQP::NOPARAM, ['content_type' => 'text/xml']);
// $testExchange->publish($msg, 'scan', AMQP_NOPARAM,
// 	['headers' => ['x-model'=>'object', 'x-type' => 123]]);
//var_dump($ex);
echo "------  publish Ok  --------\n";
$cnn->disconnect();
All Usage Examples Of AMQPExchange::setArgument