まで問題は発生していませんでした。いいえ、このような機能はありません。ただし、Illuminate\Queue\Events\Looping
イベント(Laravel 5.4より前はilluminate.queue.looping
)をリッスンして実装し、キューサイズを確認するのは簡単です。
<?php
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Queue\Events\Looping;
class QueueSizeCheckerAndEventThingieSubscriber {
public function subscribe(Dispatcher $events) {
$events->listen(Looping::class, self::class . '@onQueueLoop'); // >= 5.4
$events->listen('illuminate.queue.looping', self::class . '@onQueueLoop'); // < 5.4
}
public function onQueueLoop() {
$queueName = 'my-queue';
$queueSize = Queue::size($queueName);
if ($queueSize === 0) {
// Trigger your event.
}
}
}