laravelqueuebeanstalkdlaravel-4.2

Laravel Queue PushRaw Delay?


I have an app wherein from laravel 4.2 I am slowly transitioning it to node.

Now I have this Queue::pushRaw(payload, tube) the job is in node and this code is working perfectly fine.

However I recently have a problem wherein I need those jobs to have a delay.

I use Queue::later before (when my jobs is still in Laravel), but how can I do it with Queue::pushRaw ?? I can't use Queue::later anymore since I'm passing a raw payload instead of a job.

Base on the documents I can pass options https://laravel.com/api/4.2/Illuminate/Queue/QueueInterface.html

However, I have no idea what to pass on options to have a delay.


Solution

  • Upon further investigation, I discovered this file: https://github.com/laravel/framework/blob/4.2/src/Illuminate/Queue/BeanstalkdQueue.php#L66 (I'm using Beanstald)

    You can't really pass a delay since DEFAULT_DELAY is 0.

    So my solution is to create a job in Laravel.

    I can then do Queue::later(delay, myJobThatCallsThePushRaw, data, queue);

    and then on myJobThatCallsThePushRaw I do Queue::pushRaw(my-node-payload) inside.

    Hope this helps someone in the future.