当前位置: 首页>>代码示例>>PHP>>正文


PHP AMQPConnection::setPassword方法代码示例

本文整理汇总了PHP中AMQPConnection::setPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPConnection::setPassword方法的具体用法?PHP AMQPConnection::setPassword怎么用?PHP AMQPConnection::setPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AMQPConnection的用法示例。


在下文中一共展示了AMQPConnection::setPassword方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (empty($this->user)) {
         throw new \Exception("Parameter 'user' was not set for AMQP connection.");
     }
     if (empty(self::$ampqConnection)) {
         self::$ampqConnection = new \AMQPConnection();
         self::$ampqConnection->setHost($this->host);
         self::$ampqConnection->setPort($this->port);
         self::$ampqConnection->setLogin($this->user);
         self::$ampqConnection->setPassword($this->password);
         self::$ampqConnection->setVhost($this->vhost);
         self::$ampqConnection->connect();
     }
 }
开发者ID:andriell,项目名称:yii2-amqp,代码行数:18,代码来源:Amqp.php

示例2: connection

 /**
  * Returns AMQP connection
  *
  * @return AMQPConnection
  */
 public function connection()
 {
     if (!$this->connection) {
         if (!$this->host || !$this->port) {
             throw new \InvalidArgumentException(sprintf("Remote host or port undefined '%s:%s' ", $this->host, $this->port));
         }
         $this->connection = new \AMQPConnection();
         $this->connection->setHost($this->host);
         $this->connection->setPort($this->port);
         $this->connection->setLogin($this->user);
         $this->connection->setPassword($this->password);
         $this->vhost and $this->connection->setVhost($this->vhost);
         $this->connection->connect();
     }
     return $this->connection;
 }
开发者ID:gallna,项目名称:amqp-event,代码行数:21,代码来源:Broker.php

示例3: setPassword

 /**
  * @inheritdoc
  */
 public function setPassword($password)
 {
     try {
         return $this->delegate->setPassword($password);
     } catch (\AMQPConnectionException $e) {
         throw new ConnectionException($e->getMessage(), $e->getCode(), $e);
     }
 }
开发者ID:treehouselabs,项目名称:queue,代码行数:11,代码来源:Connection.php

示例4: getAMQPConnection

 /**
 AMQP Connection
 */
 protected function getAMQPConnection()
 {
     $connection = new AMQPConnection();
     $connection->setHost('127.0.0.1');
     $connection->setLogin('guest');
     $connection->setPassword('guest');
     $connection->connect();
     return $connection;
 }
开发者ID:blake2002,项目名称:rabbitmq-tutorials,代码行数:12,代码来源:rpc_client.php

示例5: GetConnectionObject

 /**
  * Return AMQPConnection object passed to all other calls
  * @param array $details Array of connection details
  * @return AMQPConnection
  */
 function GetConnectionObject($details)
 {
     $connection = new AMQPConnection();
     $connection->setHost($details['host']);
     $connection->setLogin($details['login']);
     $connection->setPassword($details['password']);
     $connection->setVhost($details['vhost']);
     $connection->setPort($details['port']);
     return $connection;
 }
开发者ID:UGuarder,项目名称:celery-php,代码行数:15,代码来源:amqppeclconnector.php

示例6: InitializeAMQPConnection

 static function InitializeAMQPConnection($details)
 {
     $connection = new AMQPConnection();
     $connection->setHost($details['host']);
     $connection->setLogin($details['login']);
     $connection->setPassword($details['password']);
     $connection->setVhost($details['vhost']);
     $connection->setPort($details['port']);
     return $connection;
 }
开发者ID:NaszvadiG,项目名称:cim-xa,代码行数:10,代码来源:celery.php

示例7: createAMQPConnection

 protected function createAMQPConnection()
 {
     $connection = new AMQPConnection();
     $connection->setHost($this->getHost());
     $connection->setPort($this->getPort());
     $connection->setVhost($this->getVhost());
     $connection->setLogin($this->getLogin());
     $connection->setPassword($this->getPassword());
     $connection->connect();
     return $connection;
 }
开发者ID:rurri,项目名称:log4php-graylog2,代码行数:11,代码来源:LoggerAppenderAMQP.php

示例8: getConnection

 /**
  * @return \AMQPConnection
  */
 public function getConnection()
 {
     if ($this->connection === null) {
         $settings = $this->connectionSettings;
         $connection = new \AMQPConnection();
         $connection->setHost($settings['host']);
         $connection->setPort($settings['port']);
         $connection->setLogin($settings['user']);
         $connection->setPassword($settings['password']);
         $connection->connect();
         $this->connection = $connection;
     }
     return $this->connection;
 }
开发者ID:IvixLabs,项目名称:RabbitmqBundle,代码行数:17,代码来源:ConnectionStorage.php

示例9: getBrokerStatus

 function getBrokerStatus()
 {
     $amqpConnection = new AMQPConnection();
     $amqpConnection->setLogin("guest");
     $amqpConnection->setPassword("guest");
     $amqpConnection->setVhost("/");
     $amqpConnection->connect();
     if (!$amqpConnection->isConnected()) {
         log("info", "Cannot connect to the broker!");
         return false;
     }
     $amqpConnection->disconnect();
     return true;
 }
开发者ID:NaszvadiG,项目名称:cim-xa,代码行数:14,代码来源:celeryclientlib.php

示例10: connect

 /**
  * Connects to the broken
  *
  * @return CakeAmqpBase
  * @throws CakeException 
  */
 public function connect()
 {
     if ($this->connected()) {
         throw new CakeException(__d('cake_amqp', 'Already connected to broker'));
     }
     $this->_connection = new AMQPConnection();
     $this->_connection->setHost($this->_config['host']);
     $this->_connection->setPort($this->_config['port']);
     $this->_connection->setLogin($this->_config['user']);
     $this->_connection->setPassword($this->_config['pass']);
     $this->_connection->setVhost($this->_config['vhost']);
     $this->_connection->connect();
     $this->_channel = new AMQPChannel($this->_connection);
     return $this;
 }
开发者ID:jellehenkens,项目名称:CakeAmqp,代码行数:21,代码来源:CakeAmqpBase.php

示例11: checkRabbitMQ

 private function checkRabbitMQ()
 {
     $amqpConnection = new AMQPConnection();
     $amqpConnection->setHost($this->mqHost);
     $amqpConnection->setLogin($this->mqUser);
     $amqpConnection->setPassword($this->mqPass);
     $amqpConnection->setVhost($this->mqVhost);
     $amqpConnection->setPort($this->mqPort);
     $amqpConnection->connect();
     return $amqpConnection->isConnected();
 }
开发者ID:rumpranger,项目名称:hosting-scripts,代码行数:11,代码来源:monitor-service-connections.php

示例12: AMQPConnection

<?php

$connection = new AMQPConnection();
$connection->setHost('127.0.0.1');
$connection->setLogin('guest');
$connection->setPassword('guest');
$connection->connect();
开发者ID:rakutentech,项目名称:php-buildpack,代码行数:7,代码来源:index.php

示例13: AMQPConnection

<?php

phpinfo();
exit;
//Establish connection to AMQP
$connection = new AMQPConnection();
$connection->setHost('192.168.1.104');
$connection->setLogin('qianxun');
$connection->setPassword('qianxun');
$connection->connect();
//Create and declare channel
$channel = new AMQPChannel($connection);
//AMQPC Exchange is the publishing mechanism
$exchange = new AMQPExchange($channel);
try {
    $routing_key = 'hello';
    $queue = new AMQPQueue($channel);
    $queue->setName($routing_key);
    $queue->setFlags(AMQP_NOPARAM);
    $queue->declareQueue();
    $message = 'nowtime:' . time() . '[' . date('Y-m-d H:i:s') . ']';
    $exchange->publish($message, $routing_key);
    $connection->disconnect();
} catch (Exception $ex) {
    print_r($ex);
}
开发者ID:zhaojianhui129,项目名称:headFirst,代码行数:26,代码来源:index.php

示例14: AMQPConnection

<?php

echo "<pre>";
//$conn_args = array("host"=>'localhost','port'=>5672,'login'=>'guest',"password"=>'guest','vhost'=>'/');
//$conn = new AMQPConnection($conn_args);
$conn = new AMQPConnection();
$conn->setLogin("guest");
$conn->setPassword("guest");
$conn->setPort(5672);
$conn->setVhost("/");
if ($conn->connect()) {
    echo "Success\r\n";
} else {
    echo "Fail\r\n";
}
var_dump($conn);
开发者ID:flydement,项目名称:MyTest,代码行数:16,代码来源:connect.php

示例15: createAMQPConnection

 /**
  * @param string $host
  * @param int $port
  * @param string $vhost
  * @param string $login
  * @param string $password
  * @param float $connectionTimeout
  * @return AMQPConnection
  * @throws AMQPConnectionException
  * @throws Exception
  */
 protected function createAMQPConnection($host, $port, $vhost, $login, $password, $connectionTimeout)
 {
     $connection = new AMQPConnection();
     $connection->setHost($host);
     $connection->setPort($port);
     $connection->setVhost($vhost);
     $connection->setLogin($login);
     $connection->setPassword($password);
     $connection->setReadTimeout($connectionTimeout);
     if (!$connection->connect()) {
         throw new Exception('Cannot connect to the broker');
     }
     return $connection;
 }
开发者ID:wikimart,项目名称:log4php-graylog2,代码行数:25,代码来源:LoggerAppenderAMQP.php


注:本文中的AMQPConnection::setPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。