コード例 #1
0
 /**
  * Create service with name
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @param string $name
  * @param string $requestedName
  * @return AMQPConnection
  */
 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     $config = $this->getConfig($serviceLocator);
     $options = new ConnectionOptions($config[$this->subConfigKey][$requestedName]);
     $connection = new AMQPConnection($options->toArray());
     if ($options->getPersistent()) {
         $connection->persistent = true;
     }
     return $connection;
 }
コード例 #2
0
 public function testGettersAndSetters()
 {
     $options = new ConnectionOptions(array('host' => 'localhost', 'port' => 5672, 'login' => 'guest', 'password' => 'passwd', 'vhost' => '/', 'persistent' => false, 'readTimeout' => 1.0, 'writeTimeout' => 2.0));
     $this->assertSame('localhost', $options->getHost());
     $this->assertSame(5672, $options->getPort());
     $this->assertSame('guest', $options->getLogin());
     $this->assertSame('passwd', $options->getPassword());
     $this->assertSame('/', $options->getVhost());
     $this->assertFalse($options->getPersistent());
     $this->assertEquals(1.0, $options->getReadTimeout());
     $this->assertEquals(2.0, $options->getWriteTimeout());
 }