2

I have a quite simple job that runs on Laravel 4 FW. When the queue driver is set as "sync", it works fine. But, when I set it to 'beanstalkd', it simply DOESN'T RUN! I already ran the artisan command php artisan queue:listen and php artisan queue:work but none seems to work.

When I type php artisan queue:work it gives me the following error:

[ErrorException]                      
Trying to get property of non-object  

Here's my beanstalkd connection configuration:

'beanstalkd' => array(
    'driver' => 'beanstalkd',
    'host'   => 'localhost:11300',
    'queue'  => 'default',
),

I've already tried to set the 'host' as a '0.0.0.0' and '127.0.0.1'.

Any ideas why isn't working?

EDIT:
Here's some piece of code of the fire() method.

static public function fire($job, $data)
{
    ini_set('memory_limit', '512M');
    set_time_limit(300);

    $hotel_ids = $data['hotels'];
    self::$client    = $data['client'];
    self::$currency  = $data['currency'];

    // A list of paths to the generated PDFs
    $paths = array();

    foreach ($hotel_ids as $list) {
        $hotels =  Hotel::whereIn('id', $list)->orderBy('name', 'asc')->get();

        $paths[] = self::makePDF($hotels);  
    }

    #self::sentPDFs($paths);

    $job->delete();
}

EDIT 2:
The job itself run on sync driver, though my thoughts are on beanstalkd. I installed the beanstalkd console, a way of view the jobs and the queue grafically. Here's another interesting thing: the job is queued, he gets in the 'ready' stage then goes back! And that keeps going on! He gets in ready stage, e then (I believe) happens some sort of error and it get's out!I don't know what is the error, since it doesn't appear in SYNC drive.

Another interesting thing: if I remove all code from the fire method and lets only, for example, Log::error('Error'); it happens the same exact thing!

Dennis Braga
  • 1,448
  • 3
  • 20
  • 40
  • What information you giving your job? What does the job do? Does it rely on session-based information, or anything not generally available via PHP CLI call? (Leke things in the $_SERVER global)? Your error message without any context isn't enough information to go on. – fideloper Oct 22 '13 at 21:27
  • The only information that I'm passing to the fire() method is a reference the job itself and the array $data. $data is putting values in proteced class properties (the class begin the job's class). This job aim to generete PDFs files, with data coming from the database. I do the research in job's class. Does not (at least in the front) rely on any server information. **Just a beatiful Laravel code**. What really get my attention is that it works fine in the SYNC drive, but not on Beanstalk. – Dennis Braga Oct 23 '13 at 11:54
  • @fideloper Added some code, hope it helps! – Dennis Braga Oct 23 '13 at 11:59
  • Have you had the queue working at all? I would suggest that you try a test using the basic mail queue. First check you can send out an email, then try to queue one. This will take your custom job out the equation and let you know if you have installed beanstalkd correctly. What kind of server are you running and how did you install beanstalkd? – SwiftD Oct 29 '13 at 10:09
  • The queue works! I already have a e-mail system running. I install beanstalk by `apt-get`, and I use Ubuntu12.04 LTS on development, and in production I use a other instalation that I get from somewhere else, but already manager the e-mails. So I think the installation isn't the problem! My production server is a modified Ubuntu from Linode. I don't know exactly the version that they did use to made them version. – Dennis Braga Oct 29 '13 at 11:25

2 Answers2

0

Have you installed Pheanstalk? It's required to use beanstalkd with the Laravel queue system.

Makita
  • 1,812
  • 12
  • 15
0

Check your firewall configuration. I added port 11300 to the firewall tables and it works!

fahrulazmi
  • 734
  • 9
  • 12