Support the ongoing development of Laravel.io →
posted 9 years ago
Queues
Last updated 1 year ago.
0
Solution

I found a way to do this (For SQS):

$sqs_instance=Queue::getSqs();
$sqs_instance->delete($job_id);
Last updated 1 year ago.
0

I stumbled on this looking for a way to do this in Redis. For those in Redis See Edit 1 here. I was abale to remove all Queues by flushing Redis. FLUSHDB wil; "Delete all the keys of the currently selected DB."

$ redis-cli
127.0.0.1:6379> FLUSHDB
OK
127.0.0.1:6379> exit 
Last updated 1 year ago.
0

the $job->delete() method uses redis client zrem($listName, $job) to delete the job from redis , in this case it may be :


$jobId = \Queue::push('DoTheJob', array('data'=>array(1,2,3)));

// Delete job 
$this->redisDb->zrem("queue:sms_orders", $jobId); // redisDb from: Illuminate\Redis\Database

Last updated 1 year ago.
0

I made an artisan command which will clear all the jobs in your queue. You can optionally specify the connection and/or the pipe.

https://github.com/morrislaptop/laravel-queue-clear

0

Sign in to participate in this thread!

Eventy

Your banner here too?

opilo opilo Joined 20 Apr 2014

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.