I’m encountering an issue with Laravel Queue RabbitMQ when using the quorum queue type. Here’s the setup:
Laravel version: 10
Package: [vyuldashev/laravel-queue-rabbitmq]
Queue type: Quorum
Issue: Jobs are not being added to the queue after a few minutes of running the application. Specifically, the last 10 to 12 jobs that were supposed to be added to the queue are not getting queued.
I have a Laravel command (JobFakerCommand) that dispatches a specified number of jobs to the queue. Each job is uniquely identified by an ID, and this ID is stored in Redis. When a consumer processes a job, its corresponding ID is removed from Redis.
Here’s the relevant part of the code:
<?php
namespace AppConsoleCommands;
use AppJobsTestSimpleJob;
use CarbonCarbon;
use IlluminateConsoleCommand;
use IlluminateSupportFacadesCache;
use IlluminateSupportStr;
class JobFakerCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'run-job
{--count=100 : Number of jobs per run}
{--queue=queue1 : queue}
{--connection=rabbitmq : queue connection}
{--job=Simple : jobName}';
/**
* Execute the console command.
*/
public function handle()
{
$count = (int) $this->option('count');
$job = $this->option('job');
$queue = $this->option('queue');
$connection = $this->option('connection');
$time = Carbon::now()->timestamp;
$jobName = "AppJobs\Test".($job).'Job';
$i = 0;
while ($i < $count){
$uuid = $job."-".$time."-".$i;
$var = $jobName::dispatch($uuid)->onConnection($connection)->onQueue($queue);
unset($var);
Cache::set($uuid , 0);
$i++;
}
}
}
class Kernel extends ConsoleKernel
{
protected $commands = [
JobFakerCommand::class,
WipeStorageCommand::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command(JobFakerCommand::class , ['--count='.env('LongPayloadCount' , 100) , '--job=LongPayload' , '--connection=rabbitmq' , '--queue=queue1'])->runInBackground()->everyMinute();
$schedule->command(JobFakerCommand::class , ['--count='.env('LongTimeCount' , 100), '--job=LongTime' , '--connection=rabbitmq' , '--queue=queue2'])->runInBackground()->everyMinute();
$schedule->command(JobFakerCommand::class , ['--count='.env('SimpleCount' , 100) , '--job=Simple' , '--connection=rabbitmq' , '--queue=queue3'])->runInBackground()->everyMinute();
}
}
The problem seems to occur only when using the quorum queue type. When using the classic queue type, everything works fine.
What could be causing this issue with the quorum queue type? Any insights or suggestions for troubleshooting would be greatly appreciated. Thank you!