コード例 #1
0
 /**
  * @param  \Illuminate\Queue\QueueManager  $manager
  * @return void
  */
 protected function registerSortedRedisConnector($manager)
 {
     $app = $this->app;
     $manager->addConnector("sorted-redis", function () use($app) {
         return new SortedRedisConnector($app["redis"]);
     });
 }
コード例 #2
0
ファイル: QueueServiceProvider.php プロジェクト: owlgrin/plus
 /**
  * Register the Redis queue connector.
  *
  * @param  \Illuminate\Queue\QueueManager  $manager
  * @return void
  */
 protected function registerRedisConnector($manager)
 {
     $app = $this->app;
     $manager->extend('redis', function () use($app) {
         return new RedisConnector($app['redis']);
     });
 }
コード例 #3
0
 /**
  * Register the GAE queue connector.
  *
  * @param  \Illuminate\Queue\QueueManager  $manager
  * @return void
  */
 protected function registerGaeConnector($manager)
 {
     $app = $this->app;
     $manager->addConnector('gae', function () use($app) {
         return new GaeConnector($app['encrypter'], $app['request']);
     });
 }
コード例 #4
0
ファイル: Laravel.php プロジェクト: RamaneekGill/Raven
 /**
  * {@inheritdoc}
  *
  * @throws \RuntimeException Thrown if the queue has not been set.
  */
 public function process($url, $data, array $headers = [])
 {
     if (empty($this->queue)) {
         throw new RuntimeException('Queue not set');
     }
     $data = ['url' => $url, 'data' => $data, 'headers' => $headers, 'transport' => $this->transport->toArray()];
     $this->queue->push('rcrowe\\Raven\\Handler\\Laravel\\Job', $data);
 }
コード例 #5
0
 /**
  * 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);
 }
コード例 #6
0
 /**
  * Register the Resque queue connector.
  *
  * @param \Illuminate\Queue\QueueManager $manager
  * @return void
  */
 protected function registerResqueConnector($manager)
 {
     $manager->addConnector('resque', function () {
         $config = Config::get('database.redis.default');
         Config::set('queue.connections.resque', array_merge($config, ['driver' => 'resque']));
         return new ResqueConnector();
     });
 }
コード例 #7
0
 /**
  * Handle the event.
  *
  * @param  VoteWasOpened $event
  * @return void
  */
 public function handle(VoteWasOpened $event)
 {
     /**
      * Queue OpenVoteCommand
      */
     $command = new CloseVotingCommand($event->vote);
     $delay = $event->vote->close_date->timestamp - $this->carbon->now()->timestamp;
     $this->queue->laterOn('voting', $delay, $command);
 }
コード例 #8
0
 /**
  * {@inheritDoc}
  */
 public function clear($connection, $queue)
 {
     $count = 0;
     $connection = $this->manager->connection($connection);
     while ($job = $connection->pop($queue)) {
         $job->delete();
         $count++;
     }
     return $count;
 }
コード例 #9
0
ファイル: Worker.php プロジェクト: flelievre/EasyVisit
 /**
  * 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);
     }
 }
コード例 #10
0
 /**
  * Register the Resque queue connector.
  *
  * @param  \Illuminate\Queue\QueueManager  $manager
  * @return void
  */
 protected function registerResqueConnector($manager)
 {
     $connections = Config::get('queue.connections', []);
     foreach ($connections as $connection) {
         if ($connection['driver'] !== 'resque') {
             $manager->addConnector($connection['driver'], function () {
                 return new ResqueConnector();
             });
         }
     }
     $manager->addConnector('resque', function () {
         $config = Config::get('database.redis.default');
         Config::set('queue.connections.resque', array_merge($config, ['driver' => 'resque']));
         return new ResqueConnector();
     });
 }
コード例 #11
0
ファイル: Mailer.php プロジェクト: SerdarSanri/mailman
 /**
  * Queue a new e-mail message for sending after (n) seconds.
  *
  * @param  int  $delay
  * @param  string  $queue
  * @return void
  */
 public function later($delay, $queue = null)
 {
     if ($this->queueManager) {
         $swiftMessage = $this->message->getSwiftMessage();
         $this->queueManager->later($delay, new SendEmailJob($swiftMessage), $queue);
     }
 }
コード例 #12
0
ファイル: Client.php プロジェクト: twineis/raven-php
 /**
  * {@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;
 }
コード例 #13
0
 /**
  * Installs dependencies.
  *
  * @return boolean
  */
 public function install()
 {
     if (!$this->isInstalling()) {
         $this->queue->push(ComposerInstallJob::class);
         return true;
     } else {
         return false;
     }
 }
コード例 #14
0
ファイル: Worker.php プロジェクト: bryanashley/framework
 /**
  * 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);
 }
コード例 #15
0
 /**
  * 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];
 }
コード例 #16
0
ファイル: Client.php プロジェクト: brucewu16899/laravel-raven
 /**
  * {@inheritdoc}
  */
 public function send($data)
 {
     // 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->push('Clowdy\\Raven\\Job', $data, $this->customQueue);
     } catch (Exception $e) {
         $this->sendError($data);
     }
     return;
 }
コード例 #17
0
ファイル: Worker.php プロジェクト: davidhemphill/framework
 /**
  * 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);
 }
コード例 #18
0
 /**
  * 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);
 }
コード例 #19
0
ファイル: Manager.php プロジェクト: saj696/pipe
 /**
  * Get a registered connection instance.
  *
  * @param  string $name
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function getConnection($name = null)
 {
     return $this->manager->connection($name);
 }
コード例 #20
0
 /**
  * Register the IronMQ queue connector.
  *
  * @param  \Illuminate\Queue\QueueManager  $manager
  * @return void
  */
 protected function registerIronConnector($manager)
 {
     $app = $this->app;
     $manager->addConnector('iron', function () use($app) {
         return new IronConnector($app['encrypter'], $app['request']);
     });
     $this->registerIronRequestBinder();
 }
コード例 #21
0
 /**
  * Register the Async queue connector.
  *
  * @param \Illuminate\Queue\QueueManager $manager
  *
  * @return void
  */
 protected function registerMongoDBConnector($manager)
 {
     $manager->addConnector('mongodb', function () {
         return new MongoDBConnector($this->app['db']);
     });
 }
コード例 #22
0
 /**
  * Register the Stomp queue connector.
  *
  * @param \Illuminate\Queue\QueueManager $manager
  *
  * @return void
  */
 protected function registerStompConnector($manager)
 {
     $manager->addConnector('stomp', function () {
         return new StompConnector();
     });
 }
コード例 #23
0
ファイル: SMS.php プロジェクト: borislalov/simple-sms
 /**
  * Queues a message to be sent a later time.
  *
  * @param int $delay The desired delay in seconds
  * @param string $view The desired view.
  * @param array $data An array of data to fill the view.
  * @param  \Closure|string $callback The callback to run on the Message class.
  * @param null|string $queue The desired queue to push the message to.
  * @return void
  */
 public function later($delay, $view, array $data, $callback, $queue = null)
 {
     $callback = $this->buildQueueCallable($callback);
     $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
 }
コード例 #24
0
 /**
  * Register the MNS queue connector.
  *
  * @param \Illuminate\Queue\QueueManager $manager
  *
  * @return void
  */
 protected function registerConnector($manager)
 {
     $manager->addConnector('mns', function () {
         return new MNSConnector();
     });
 }
コード例 #25
0
 /**
  * Get the full name for the given connection.
  *
  * @param string $connection
  * @return string
  * @static
  */
 public static function getName($connection = null)
 {
     return \Illuminate\Queue\QueueManager::getName($connection);
 }
コード例 #26
0
ファイル: Laravel.php プロジェクト: tonijz/raven
 /**
  * {@inheritdoc}
  */
 public function process(Client $client, array $message)
 {
     $data = array('message' => $this->encodeMessage($message), 'client' => Client::getClientOptions($client), 'transport' => $this->getTransport()->toArray());
     $this->queue->push('rcrowe\\Raven\\Handler\\Laravel\\Job', $data);
 }
コード例 #27
0
 /**
  * Register the Async queue connector.
  *
  * @param \Illuminate\Queue\QueueManager $manager
  *
  * @return void
  */
 protected function registerAsyncConnector($manager)
 {
     $manager->addConnector('async', function () {
         return new AsyncConnector($this->app['db']);
     });
 }
コード例 #28
0
 /**
  * Register the Amazon SQS queue connector.
  *
  * @param \Illuminate\Queue\QueueManager $manager        	
  * @return void
  */
 protected function registerSqsConnector($manager)
 {
     $manager->addConnector('sqs', function () {
         return new SqsConnector();
     });
 }
コード例 #29
0
ファイル: _ide_helper.php プロジェクト: satriashp/tour
 /**
  * Determine if the application is in maintenance mode.
  *
  * @return bool 
  * @static 
  */
 public static function isDownForMaintenance()
 {
     return \Illuminate\Queue\QueueManager::isDownForMaintenance();
 }
コード例 #30
0
 /**
  * Register the IronMQ queue connector.
  *
  * @param  \Illuminate\Queue\QueueManager  $manager
  * @return void
  */
 protected function registerIronConnector($manager)
 {
     $app = $this->app;
     $manager->addConnector('iron', function () use($app) {
         return new IronConnector($app['request']);
     });
 }