setArgument() public method

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.
return boolean TRUE on success or FALSE on failure.
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();
Example #2
0
 /**
  * @param $key
  * @param $value
  *
  * @return bool
  */
 public function setArgument($key, $value)
 {
     return $this->rawExchange->setArgument($key, $value);
 }
Example #3
0
 /**
  * @inheritdoc
  */
 public function setArgument(string $key, $value)
 {
     $this->exchange->setArgument($key, $value);
 }