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 :)
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community