Laravel 4队列失败

时间:2015-11-13 08:07:48

标签: php laravel laravel-5 beanstalkd

我有:

use GrahamCampbell\Flysystem\Facades\Flysystem;

class GenerateInvoiceAttachment
{
    use CommonJobTrait;

    public function fire($job, $invoice)
    {
        $this->databaseReconnect();

        $invoice = InvoiceOut::findOrFail($invoice['id']);

        $form = new \Forms\Invoice($invoice->job->enquiryId);
        $PDF = $form->toPDF()->output();

        $filename = 'SI' . $invoice->id . '-J' . $invoice->jobId;

        Flysystem::put('/invoices/' . $filename.'.pdf', $PDF);

        $attachment = new \Enquiry\Attachment();

        $attachment->enquiryId = $invoice->job->enquiry->id;
        $attachment->userId = Auth::id();
        $attachment->date = Time::now();
        $attachment->filename = $filename;
        $attachment->filesize = Flysystem::getSize('/invoices/' . $filename.'.pdf');
        $attachment->stored_filename = $filename;
        $attachment->mime_type = Flysystem::getMimetype('/invoices/' . $filename.'.pdf');
        $attachment->save();

        $invoice->pdf_created = 1;
        $invoice->save();

        $job->delete();
    }

}

使用以下方式调用:

...
Queue::push('GenerateInvoiceAttachment', ['id' => $invoice->id]);
...

但是当它运行时,它会一次性导致相同的错误:

Nov 13 07:50:09 view-hhvm view-hhvm:  [2015-11-13 07:50:01] production.ERROR: exception 'ReflectionException' with message 'Class GenerateInvoiceAttachment does not exist' in /var/www/html/laravel/bootstrap/compiled.php:235 
Nov 13 07:50:09 view-hhvm Stack:  trace: 
Nov 13 07:50:09 view-hhvm #0:  /var/www/html/laravel/bootstrap/compiled.php(235): ReflectionClass->__construct('GenerateInvoice...') 
Nov 13 07:50:09 view-hhvm #1:  /var/www/html/laravel/bootstrap/compiled.php(205): Illuminate\Container\Container->build('GenerateInvoice...', Array) 
Nov 13 07:50:09 view-hhvm #2:  /var/www/html/laravel/bootstrap/compiled.php(583): Illuminate\Container\Container->make('GenerateInvoice...', Array) 
Nov 13 07:50:09 view-hhvm #3:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(107): Illuminate\Foundation\Application->make('GenerateInvoice...') 
Nov 13 07:50:09 view-hhvm #4:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(94): Illuminate\Queue\Jobs\Job->resolve('GenerateInvoice...') 
Nov 13 07:50:09 view-hhvm #5:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php(50): Illuminate\Queue\Jobs\Job->resolveAndFire(Array) 
Nov 13 07:50:09 view-hhvm #6:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(205): Illuminate\Queue\Jobs\BeanstalkdJob->fire() 
Nov 13 07:50:09 view-hhvm #7:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(157): Illuminate\Queue\Worker->process('beanstalkd', Object(Illuminate\Queue\Jobs\BeanstalkdJob), '10', 0) 
Nov 13 07:50:09 view-hhvm #8:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(111): Illuminate\Queue\Worker->pop(NULL, NULL, 0, 3, '10') 
Nov 13 07:50:09 view-hhvm #9:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(83): Illuminate\Queue\Worker->runNextJobForDaemon(NULL, NULL, 0, 3, '10') 
Nov 13 07:50:09 view-hhvm #10:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(99): Illuminate\Queue\Worker->daemon(NULL, NULL, 0, 128, 3, '10') 
Nov 13 07:50:09 view-hhvm #11:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(67): Illuminate\Queue\Console\WorkCommand->runWorker(NULL, NULL, 0, 128, true) 
Nov 13 07:50:09 view-hhvm #12:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(112): Illuminate\Queue\Console\WorkCommand->fire() 
Nov 13 07:50:09 view-hhvm #13:  /var/www/html/laravel/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(253): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
Nov 13 07:50:09 view-hhvm #14:  /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(100): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
Nov 13 07:50:09 view-hhvm #15:  /var/www/html/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php(889): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
Nov 13 07:50:09 view-hhvm #16:  /var/www/html/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
Nov 13 07:50:09 view-hhvm #17:  /var/www/html/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
Nov 13 07:50:09 view-hhvm #18:  /var/www/html/laravel/artisan(59): Symfony\Component\Console\Application->run() 

导致此问题的原因以及如何解决?

0 个答案:

没有答案