當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。