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


PHP Queue::connection方法代码示例

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


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

示例1: boot

 public function boot()
 {
     $this->package('orlissenberg/laravel-zendserver-pushqueue');
     // 1. Need a route to marshal requests.
     \Route::any("/queue/zendserver", function () {
         /** @var ZendJobQueue $connection */
         $connection = \Queue::connection("zendjobqueue");
         $connection->marshal();
     });
     // 2. Add the connector to the Queue facade.
     \Queue::addConnector("zendserver", function () {
         return app()->make("\\Orlissenberg\\Queue\\Connectors\\ZendJobQueueConnector");
     });
     // 3. Add configuration to the app/config/queue.php
     /*
     'zendjob' => [
         'driver' => 'zendserver',
         'options' => [],
         'callback-url' => '/queue/zendserver',
     ],
     */
     // 4. Enable the test route (optional for testing only)
     /*
     \Route::get(
         "/queue/zendtest",
         function () {
             $connection = \Queue::connection("zendjobqueue");
             $connection->push("\\Orlissenberg\\Queue\\Handlers\\TestHandler@handle", ["laravel4" => "rocks"]);
     
             return "Job queued.";
         }
     );
     */
 }
开发者ID:orlissenberg,项目名称:laravel-zendserver-pushqueue,代码行数:34,代码来源:ZendJobQueueServiceProvider.php

示例2: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  * @throws Exception
  */
 public function handle()
 {
     $user = User::findOrFail($this->argument('userId'));
     if ($this->option('regenerate')) {
         $albums = $user->albums;
     } else {
         $albums = $user->albums()->whereNull('thumbnailImageFileId')->get();
     }
     foreach ($albums as $album) {
         \Queue::connection('sync')->push(new MakeAlbumThumbnailJob($album));
     }
 }
开发者ID:antriver,项目名称:ctrlv-api,代码行数:18,代码来源:MakeUserThumbnails.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  * @throws Exception
  */
 public function handle()
 {
     $image = Image::findOrFail($this->argument('imageId'));
     if (!empty($image->thumbnailImageFileId)) {
         if (!$this->option('regenerate')) {
             throw new Exception("Image already has a thumbnail and --regenerate was not set");
         }
         $thumbnail = $image->getThumbnailImageFile();
         \Queue::connection('sync')->push(new DeleteFileJob($thumbnail->getPath()));
         $thumbnail->delete(false);
     }
     \Queue::connection('sync')->push(new MakeThumbnailJob($image->getImageFile()));
 }
开发者ID:antriver,项目名称:ctrlv-api,代码行数:19,代码来源:MakeThumbnail.php

示例4: getDriver

 public function getDriver($alias)
 {
     try {
         if ($alias == "Auth") {
             $driver = \Auth::driver();
         } elseif ($alias == "DB") {
             $driver = \DB::connection();
         } elseif ($alias == "Cache") {
             $driver = \Cache::driver();
         } elseif ($alias == "Queue") {
             $driver = \Queue::connection();
         } else {
             return false;
         }
         return get_class($driver);
     } catch (\Exception $e) {
         $this->error("Could not determine driver/connection for {$alias}.");
         return false;
     }
 }
开发者ID:gsaulmon,项目名称:laravel-facade-dump,代码行数:20,代码来源:GeneratorCommand.php


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