Search code examples
laravelqueuebeanstalkd

Laravel + Beanstalkd - job is processed but not fired?


I`m using Beanstalkd to manage queues in my Laravel project. My job is like this:

class MyJob {
public function fire($job, $data) {
    Log::info("Something");
     .....
     .....
     .....
    $job->delete();
   }
 }

I`ve set beanstalktd to listen for jobs like this:

php artisan queue:listen 

So when I push job in the queue:

Queue::push('MyJob', array(
            .....
        );

The job is processed:

Processed: MyJob

But do not execute any of my code in the fire method..what is happening here ?


Solution

  • So the problem in my case was that I have two projects on my server, which are in different folders (lets say Project1Folder and Project2Folder). Both have job with the same name - "MyJob". So I have set the queue:listen in the Project1Folder, but running the Project2Folder job. In this case, the queue:listen should not detect and process any job, since it`s listening in different folder. But for some reason, the listener detects job with the same name was launched althought it is in different folder. This confuses the listener and it processes the job, but with no result. So what I did is to set the queue:listener to the Project2Folder - which was the project folder where I wanted to detect jobs.