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


PHP SqsClient::factory方法代码示例

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


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

示例1: testValidatesSuccessfulMd5OfBody

 /**
  * @expectedException \Aws\Sqs\Exception\SqsException
  * @expectedExceptionMessage Body MD5 mismatch for
  */
 public function testValidatesSuccessfulMd5OfBody()
 {
     $mock = new MockPlugin(array(Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Type: application/xml\r\n\r\n" . "<ReceiveMessageResponse>\n                  <ReceiveMessageResult>\n                    <Message>\n                      <MD5OfBody>fooo</MD5OfBody>\n                      <Body>This is a test message</Body>\n                    </Message>\n                  </ReceiveMessageResult>\n                </ReceiveMessageResponse>")));
     $sqs = SqsClient::factory(array('key' => 'abc', 'secret' => '123', 'region' => 'us-east-1'));
     $sqs->addSubscriber($mock);
     $sqs->receiveMessage(array('QueueUrl' => 'http://foo.com'));
 }
开发者ID:njbhatt18,项目名称:Amazon_API,代码行数:11,代码来源:SqsClientTest.php

示例2: openConnection

 /**
  * Connect to the queueing server. (AWS, Iron.io and Beanstalkd)
  * @param array $config
  * @return
  */
 public function openConnection($config)
 {
     $this->queue = \Aws\Sqs\SqsClient::factory(['credentials' => new \Aws\Common\Credentials\Credentials($config['key'], $config['secret']), 'region' => $config['region']]);
     if (!$this->queue) {
         throw new TestRuntime('connection failed or timed-out.');
     }
 }
开发者ID:namnv609,项目名称:Codeception,代码行数:12,代码来源:AmazonSQS.php

示例3:

 function __construct()
 {
     $this->CI =& get_instance();
     $this->client = SqsClient::factory(array('key' => $this->CI->config->item('sqs_access_key_id'), 'secret' => $this->CI->config->item('sqs_secret_key'), 'region' => $this->CI->config->item('aws_region')));
     $this->uuid = $this->CI->config->item('uuid');
     $this->queue = $this->CI->config->item('sqs_queue');
 }
开发者ID:janladaking,项目名称:CodeIgniter,代码行数:7,代码来源:awssqslib.php

示例4: testGetQueueArn

 public function testGetQueueArn()
 {
     $url = 'https://sqs.us-east-1.amazonaws.com/057737625318/php-integ-sqs-queue-1359765974';
     $arn = 'arn:aws:sqs:us-east-1:057737625318:php-integ-sqs-queue-1359765974';
     $sqs = SqsClient::factory(array('region' => 'us-east-1'));
     $this->assertEquals($arn, $sqs->getQueueArn($url));
 }
开发者ID:cstuder,项目名称:nagios-plugins,代码行数:7,代码来源:SqsClientTest.php

示例5: getConnection

 /**
  * Get the Aws Client instance
  * 
  * @return Aws\Sqs\SqsClient
  */
 public function getConnection()
 {
     //we have a stored connection
     if (!$this->_sqsClient) {
         $_config = $this->_getConfiguration();
         $this->_sqsClient = SqsClient::factory(array('key' => $_config['key'], 'secret' => $_config['secret'], 'region' => $_config['region']));
     }
     return $this->_sqsClient;
 }
开发者ID:svenvarkel,项目名称:magento-lilmuckers_queue,代码行数:14,代码来源:Amazon.php

示例6: connect

 public function connect(AwsSqsConfigInterface $config)
 {
     $this->service = SqsClient::factory(array('credentials' => array('key' => $config->getAccessKey(), 'secret' => $config->getSecretKey()), 'region' => $config->getRegion()));
     /*
     
             //var_dump();
             var_dump($response);
     echo $queueUrl;
     */
 }
开发者ID:sebastien-fauvel,项目名称:Amazon-Mws-Repricing,代码行数:10,代码来源:AwsSqsService.php

示例7: __construct

 /**
  *  Setup Sqs Client
  *
  * @param null $url
  * @throws SqsException
  */
 public function __construct($url)
 {
     $this->url = $url;
     if (empty($this->url)) {
         throw new SqsException('No SQS url specified.');
     }
     /**
      * Get client
      */
     $this->client = SqsClient::factory(["key" => AWS_TEAM_COMMUNICATION_KEY, "secret" => AWS_TEAM_COMMUNICATION_SECRET, 'region' => AWS_TEAM_COMMUNICATION_TABLE_REGION]);
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:17,代码来源:Sqs.php

示例8: connect

 /**
  * @inheritdoc
  */
 public function connect()
 {
     if ($this->instance !== null) {
         $this->instance = null;
         // close previous connection
     }
     $key = $this->getConfigurationValue('key');
     $secret = $this->getConfigurationValue('secret');
     $region = $this->getConfigurationValue('region');
     $this->instance = SqsClient::factory(['key' => $key, 'secret' => $secret, 'region' => $region]);
     return $this;
 }
开发者ID:resurtm,项目名称:mailer-library,代码行数:15,代码来源:SqsQueueStoreConnection.php

示例9: openConnection

 /**
  * Connect to the queueing server. (AWS, Iron.io and Beanstalkd)
  * @param array $config
  * @return
  */
 public function openConnection($config)
 {
     $params = ['region' => $config['region']];
     if (!empty($config['key']) && !empty($config['secret'])) {
         $params['credentials'] = new Credentials($config['key'], $config['secret']);
     }
     if (!empty($config['profile'])) {
         $params['profile'] = $config['profile'];
     }
     $this->queue = SqsClient::factory($params);
     if (!$this->queue) {
         throw new TestRuntime('connection failed or timed-out.');
     }
 }
开发者ID:janhenkgerritsen,项目名称:Codeception,代码行数:19,代码来源:AmazonSQS.php

示例10: client

 /**
  * Gets the configured client connection to SQS. If none is set, it will create
  * a new one out of the configuration stored using the Configure class. It is also
  * possible to provide you own client instance already configured and initialized.
  *
  * @param SqsClient $client if set null current configured client will be used
  *  if set to false, currently configured client will be destroyed
  **/
 public function client($client = null)
 {
     if ($client instanceof SqsClient) {
         $this->_client = $client;
     }
     if ($client === false) {
         return $this->_client = null;
     }
     if (empty($this->_client)) {
         $config = Configure::read('SQS');
         $this->_client = SqsClient::factory($config['connection']);
     }
     return $this->_client;
 }
开发者ID:lorenzo,项目名称:cakephp-sqs,代码行数:22,代码来源:SimpleQueue.php

示例11: testClient

 /**
  * Tests client method
  *
  * @return void
  */
 public function testClient()
 {
     Configure::write('SQS', array('connection' => array('key' => 'a', 'secret' => 'b', 'region' => 'us-east-1')));
     $queue = new SimpleQueue();
     $client = $queue->client();
     $this->assertInstanceOf('\\Aws\\Sqs\\SqsClient', $client);
     $this->assertSame($client, $queue->client());
     $queue->client(false);
     $client2 = $queue->client();
     $this->assertInstanceOf('\\Aws\\Sqs\\SqsClient', $client2);
     $this->assertNotSame($client, $client2);
     $client3 = SqsClient::factory(Configure::read('SQS.connection'));
     $queue->client($client3);
     $this->assertSame($client3, $queue->client());
 }
开发者ID:dilab,项目名称:cakephp-sqs,代码行数:20,代码来源:SimpleQueueTest.php

示例12: registerConnections

 protected function registerConnections()
 {
     /*
      * SQS
      */
     $this->app->bind('bernard.connection.sqs', function (Container $app) {
         return \Aws\Sqs\SqsClient::factory(['key' => config('bernard.drivers.sqs.connection.key'), 'secret' => config('bernard.drivers.sqs.connection.secret'), 'region' => config('bernard.drivers.sqs.connection.region')]);
     });
     /*
      * IronMQ
      */
     $this->app->bind('bernard.connection.ironmq', function (Container $app) {
         return new \IronMQ(['token' => config('bernard.drivers.ironmq.connection.token'), 'project_id' => config('bernard.drivers.ironmq.connection.project_id')]);
     });
     /*
      * Predis
      */
     $this->app->bind('bernard.connection.predis', function (Container $app) {
         $host = config('bernard.drivers.predis.connection.host');
         $options = config('bernard.drivers.predis.connection.options');
         return new \Predis\Client($host, $options);
     });
     /*
      * RabbitMQ
      */
     $this->app->bind('bernard.connection.rabbitmq', function (Container $app) {
         $host = config('bernard.drivers.rabbitmq.connection.host');
         $port = config('bernard.drivers.rabbitmq.connection.port');
         $username = config('bernard.drivers.rabbitmq.connection.username');
         $password = config('bernard.drivers.rabbitmq.connection.password');
         return new \PhpAmqpLib\Connection\AMQPStreamConnection($host, $port, $username, $password);
     });
     /*
      * Redis
      */
     $this->app->bind('bernard.connection.redis', function (Container $app) {
         $host = config('bernard.drivers.redis.connection.host');
         $post = config('bernard.drivers.redis.connection.port');
         $prefix = config('bernard.drivers.redis.connection.prefix');
         $redis = new \Redis();
         $redis->connect($host, $post);
         $redis->setOption(\Redis::OPT_PREFIX, $prefix);
         return $redis;
     });
 }
开发者ID:trihtm,项目名称:annie-framework,代码行数:45,代码来源:BernardServiceProvider.php

示例13: __construct

 /**
  * Constructor
  *
  * @param string $uri - Uri. Eg: http://sqs.ap-southeast-1.amazonaws.com/71203182391283/sample-queue
  */
 public function __construct($uri)
 {
     $parts = parse_url($uri);
     $this->scheme = @$parts['scheme'] ?: 'https';
     $hParts = explode('.', $parts['host'], 3);
     $this->region = @$hParts[1] ?: 'ap-southeast-1';
     $accessKey = @$parts['user'] ?: '';
     $accessSecret = @$parts['pass'] ?: '';
     $this->sqs = SqsClient::factory(array('key' => $accessKey, 'secret' => $accessSecret, 'region' => $this->region));
     if ($path = ltrim(@$parts['path'], '/')) {
         $pParts = explode('/', $path, 2);
         $this->accountId = $pParts[0];
         if (count($pParts) > 1 && ($queueName = $pParts[1])) {
             if (in_array(substr($queueName, -1), array('-', '_'))) {
                 parent::__construct($queueName);
             } else {
                 $this->setQueueName($queueName);
             }
         }
     }
 }
开发者ID:nandanprac,项目名称:capi,代码行数:26,代码来源:SQSQueue.php

示例14: connect

 /**
  * Establish a queue connection.
  *
  * @param  array  $config
  * @return \Illuminate\Queue\QueueInterface
  */
 public function connect(array $config)
 {
     $sqs = SqsClient::factory($config);
     return new SqsQueue($sqs, $config['queue']);
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:11,代码来源:SqsConnector.php

示例15: _openConnection

 /**
  * Connect to the queueing server. (AWS, Iron.io and Beanstalkd)
  */
 private function _openConnection()
 {
     $this->debug('');
     switch (strtolower($this->config['type'])) {
         case 'aws':
         case 'sqs':
         case 'aws_sqs':
             $this->queue = \Aws\Sqs\SqsClient::factory(array('credentials' => new \Aws\Common\Credentials\Credentials($this->config['key'], $this->config['secret']), 'region' => $this->config['region'])) or \PHPUnit_Framework_Assert::fail('connection failed or timed-out.');
             break;
         case 'iron':
         case 'iron_mq':
             $this->queue = new \IronMQ(array("token" => $this->config['token'], "project_id" => $this->config['project'], "host" => $this->config['host'])) or \PHPUnit_Framework_Assert::fail('connection failed or timed-out.');
             break;
         default:
             $this->queue = new \Pheanstalk_Pheanstalk($this->config['host'], $this->config['port'], $this->config['timeout']) or \PHPUnit_Framework_Assert::fail('connection failed or timed-out.');
     }
 }
开发者ID:Eli-TW,项目名称:Codeception,代码行数:20,代码来源:Queue.php


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