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


PHP QueueManager::connection方法代码示例

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


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

示例1: push

 /**
  * Pushes a job into a specific queue connection.
  *
  * If you are using multiple SQS queues, this method might be useful.
  * Instead of having to provide the whole queue URL every time you want to
  * push a job into it, you just provide the name of the queue connection
  * as set in the configuration file.
  *
  * @param mixed $job
  * @param array $data
  * @param string $connection Name of the connection
  * @param string $queue
  *
  * @return mixed
  */
 public function push($job, array $data, $connection = null, $queue = null)
 {
     if ($connection == null) {
         return $this->manager->push($job, $data, $queue);
     }
     $connection = $this->manager->connection($connection);
     return $connection->push($job, $data, $queue);
 }
开发者ID:MarkVaughn,项目名称:illuminated,代码行数:23,代码来源:QueuePusher.php

示例2: clear

 /**
  * {@inheritDoc}
  */
 public function clear($connection, $queue)
 {
     $count = 0;
     $connection = $this->manager->connection($connection);
     while ($job = $connection->pop($queue)) {
         $job->delete();
         $count++;
     }
     return $count;
 }
开发者ID:morrislaptop,项目名称:laravel-queue-clear,代码行数:13,代码来源:Clearer.php

示例3: pop

 /**
  * Listen to the given queue.
  *
  * @param  string  $connectionName
  * @param  string  $queue
  * @param  int     $delay
  * @param  int     $memory
  * @param  int     $sleep
  * @param  int     $maxTries
  * @return void
  */
 public function pop($connectionName, $queue = null, $delay = 0, $memory = 128, $sleep = 3, $maxTries = 0)
 {
     $connection = $this->manager->connection($connectionName);
     $job = $this->getNextJob($connection, $queue);
     // If we're able to pull a job off of the stack, we will process it and
     // then make sure we are not exceeding our memory limits for the run
     // which is to protect against run-away memory leakages from here.
     if (!is_null($job)) {
         $this->process($this->manager->getName($connectionName), $job, $maxTries, $delay);
     } else {
         $this->sleep($sleep);
     }
 }
开发者ID:flelievre,项目名称:EasyVisit,代码行数:24,代码来源:Worker.php

示例4: send

 /**
  * {@inheritdoc}
  */
 public function send($data)
 {
     $this->eventId = array_get($data, 'event_id');
     // send error now if queue not set
     if (is_null($this->queue)) {
         return $this->sendError($data);
     }
     // put the job into the queue
     // Sync connection will sent directly
     // if failed to add job to queue send it now
     try {
         $this->queue->connection(array_get($this->config, 'queue.connection'))->push(Job::class, $data, array_get($this->config, 'queue.name'));
     } catch (Exception $e) {
         return $this->sendError($data);
     }
     return;
 }
开发者ID:twineis,项目名称:raven-php,代码行数:20,代码来源:Client.php

示例5: runNextJob

 /**
  * Process the next job on the queue.
  *
  * @param  string  $connectionName
  * @param  string  $queue
  * @param  \Illuminate\Queue\WorkerOptions  $options
  * @return void
  */
 public function runNextJob($connectionName, $queue, WorkerOptions $options)
 {
     $job = $this->getNextJob($this->manager->connection($connectionName), $queue);
     // If we're able to pull a job off of the stack, we will process it and then return
     // from this method. If there is no job on the queue, we will "sleep" the worker
     // for the specified number of seconds, then keep processing jobs after sleep.
     if ($job) {
         return $this->runJob($job, $connectionName, $options);
     }
     $this->sleep($options->sleep);
 }
开发者ID:bryanashley,项目名称:framework,代码行数:19,代码来源:Worker.php

示例6: pop

 /**
  * Listen to the given queue.
  *
  * @param  string  $connectionName
  * @param  string  $queue
  * @param  int     $delay
  * @param  int     $sleep
  * @param  int     $maxTries
  * @return array
  */
 public function pop($connectionName, $queue = null, $delay = 0, $sleep = 3, $maxTries = 0)
 {
     $connection = $this->manager->connection($connectionName);
     $job = $this->getNextJob($connection, $queue);
     // If we're able to pull a job off of the stack, we will process it and
     // then immediately return back out. If there is no job on the queue
     // we will "sleep" the worker for the specified number of seconds.
     if (!is_null($job)) {
         return $this->process($this->manager->getName($connectionName), $job, $maxTries, $delay);
     }
     $this->sleep($sleep);
     return ['job' => null, 'failed' => false];
 }
开发者ID:teckwei1993,项目名称:laravel-in-directadmin,代码行数:23,代码来源:Worker.php

示例7: runNextJob

 /**
  * Process the next job on the queue.
  *
  * @param  string  $connectionName
  * @param  string  $queue
  * @param  \Illuminate\Queue\WorkerOptions  $options
  * @return void
  */
 public function runNextJob($connectionName, $queue, WorkerOptions $options)
 {
     try {
         $job = $this->getNextJob($this->manager->connection($connectionName), $queue);
         // If we're able to pull a job off of the stack, we will process it and then return
         // from this method. If there is no job on the queue, we will "sleep" the worker
         // for the specified number of seconds, then keep processing jobs after sleep.
         if ($job) {
             return $this->process($connectionName, $job, $options);
         }
     } catch (Exception $e) {
         $this->exceptions->report($e);
     } catch (Throwable $e) {
         $this->exceptions->report(new FatalThrowableError($e));
     }
     $this->sleep($options->sleep);
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:25,代码来源:Worker.php

示例8: runNextJob

 /**
  * Process the next job on the queue.
  *
  * @param  string  $connectionName
  * @param  string  $queue
  * @param  int     $delay
  * @param  int     $sleep
  * @param  int     $maxTries
  * @return void
  */
 public function runNextJob($connectionName, $queue = null, $delay = 0, $sleep = 3, $maxTries = 0)
 {
     try {
         $connection = $this->manager->connection($connectionName);
         $job = $this->getNextJob($connection, $queue);
         // If we're able to pull a job off of the stack, we will process it and then return
         // from this method. If there is no job on the queue, we will "sleep" the worker
         // for the specified number of seconds, then keep processing jobs after sleep.
         if (!is_null($job)) {
             return $this->process($this->manager->getName($connectionName), $job, $maxTries, $delay);
         }
     } catch (Exception $e) {
         if ($this->exceptions) {
             $this->exceptions->report($e);
         }
     }
     $this->sleep($sleep);
 }
开发者ID:mark86092,项目名称:laravel-framework,代码行数:28,代码来源:Worker.php

示例9: connection

 /**
  * Resolve a queue connection instance.
  *
  * @param string $name
  * @return \Illuminate\Contracts\Queue\Queue 
  * @static 
  */
 public static function connection($name = null)
 {
     return \Illuminate\Queue\QueueManager::connection($name);
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php

示例10: getConnection

 /**
  * Get a registered connection instance.
  *
  * @param  string $name
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function getConnection($name = null)
 {
     return $this->manager->connection($name);
 }
开发者ID:saj696,项目名称:pipe,代码行数:10,代码来源:Manager.php

示例11: connect

 /**
  * Establish a queue connection.
  *
  * @param  array $config
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function connect(array $config)
 {
     $shortTermQueue = $this->queueManager->connection($config['short-term-queue']);
     $longTermQueue = $this->queueManager->connection($config['long-term-queue']);
     return new HybridQueue($shortTermQueue, $longTermQueue, $config['short-term-queue'], $config['threshold']);
 }
开发者ID:halaei,项目名称:hybrid-queue,代码行数:12,代码来源:HybridQueueConnector.php

示例12: connect

 /**
  * @param  array $config
  * @return \Illuminate\Queue\QueueInterface
  */
 public function connect(array $config)
 {
     return new ProxyQueue($this->manager->connection($config['connection']));
 }
开发者ID:exolnet,项目名称:laravel-queue,代码行数:8,代码来源:ProxyConnector.php

示例13: handle

 public function handle(QueueManager $queueManager)
 {
     $queueManager->connection($this->connection)->later($this->delay, $this->job, $this->data, $this->queue);
 }
开发者ID:halaei,项目名称:hybrid-queue,代码行数:4,代码来源:HybridJob.php


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