How to get all pending jobs in laravel queue on redis?

Stefan Izdrail

Founder & Senior Architect · 2026-06-29

Laravel Company
Title: Retrieving Pending Jobs from Laravel Queue on Redis - A Comprehensive Guide for Developers Introduction: In the world of web development, efficiency and scalability are crucial for handling high volumes of traffic and ensuring optimal user experience. Laravel's queue package is designed to manage asynchronous jobs using a variety of drivers, including Redis. This post will discuss how you can retrieve pending jobs in your Laravel application's queue when using the Redis driver. Step 1: Understanding the Queue Package The Laravel queue package allows developers to schedule and process tasks asynchronously on their web applications. The package uses the concept of queues, which consist of jobs that have yet to be processed. Jobs are added to a queue when the `queue:listen` artisan command starts listening for new jobs or when you manually invoke the `Queue::push` method. Step 2: Connecting to Redis To work with Laravel's queue package using Redis, ensure you have installed and configured the Redis server and that your Laravel application can connect to it properly. Follow the official documentation for setting up and connecting to a Redis instance with Laravel. Step 3: Checking Pending Jobs With the Laravel application connected to the Redis server, we can now check the pending jobs in the queue. In your Laravel application's root directory, run the following command: `php artisan queue:failed --till-timestamp=NOW` This command will list all failed jobs with their details, including the class name and reason for failure. To see the currently queued jobs that haven't been processed yet, use the `queue:list` command: `php artisan queue:listen` The output will show a list of pending jobs in your application, organized by queue names and job classes. Step 4: Counting Pending Jobs In case you need to count the pending jobs instead of listing them all, you can use the Laravel's collections functionality. Connect to the Redis instance using `Predis\Client`, or a similar library, to access the queue as follows: ```php use Predis\Client; $redis = new Client(); $queue = $redis->getQueue('test_queue'); $countPendingJobs = $queue->keys()->count(); ``` Replace `test_queue` with the name of your queue (if needed). The code above will return the count of pending jobs in the specified queue. Step 5: Conclusion and Resources In this guide, we have provided a comprehensive overview on how to retrieve and process pending jobs in Laravel's queue using Redis as the driver. We discussed the Laravel queue package and its features, connected to the Redis instance, and explained how to check, list, and count pending jobs. Additionally, we introduced a code example for counting pending jobs from the queue. For more information on Laravel queues and their usage, visit https://laravelcompany.com/blog/understanding-and-using-queues-in-laravel or other reputable resources online that discuss Laravel's asynchronous programming approach. Remember to keep your queues well maintained for optimal application performance and scalability.