Support the ongoing development of Laravel.io →
Configuration Queues
Last updated 1 year ago.
0

Hi Skyzer,

Did you ever manage to get a proper working configuration for this? I'm working in L5.1 setting up a fairly similar environment... running multiple queues on an AWS ElastiCache Redis instance with multiple workers, two of which are running 2 or more processes . . Really interested to understand the optimal solution, and reliability. Some of the threads I've read about redis and event broadcasting posed some concerns, and I need it to be solid. Would be keen to know :)

0

For those that are interested. I solved this by creating a Job and in the constructor specifically setting up that Job to always run on a specific queue.

class MyJob extends Job implements SelfHandling, ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    protected $attribute;

    /**
     * Create a new job instance.
     *
     * @param $attribute
     * @return void
     */
    public function __construct($attribute)
    {
        $this->attribute = $attribute;
        $this->onQueue('myJobQueue');
    }
}

Then in my Supervisor setup I have the following:

[program:qlistener_myJobQueue]
command=php artisan queue:work --queue=myJobQueue --tries=5 --daemon

You could create your own custom config file or ENV variables to manage the various queue names and make use of that instead of actually hard-coding the queue name in the Job constructor.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

skyzer skyzer Joined 25 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.