Delete an off-line queue job in Laravel 4?

I understand that the listener passes the copy of the task to my employee, and I can use this instance to delete the task, but how can I delete the work outside of the worker? Consider this scenario:

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

If(!someotherjobdone){
// delete job from Queue  with job_id
?
}

thank

+4
source share
2 answers

I'm not sure if this is correct, but I think you want to “remove” the task from the queue:

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

If(!someotherjobdone){
    Queue::pop($job_id);
}

If this does not work, you can try:

$queue=Queue::getQueue($job_id);
Queue::pop($queue);
+1
source

SQS. "ReceiptHandle" (, ), , SqsClient SQSManager, IoC.

$queue_manager = App::make("queue");
$sqs_queue = $queue_manager->connection('sqs');
$sqs_client = $sqs_queue->getSqs(); 
$sqs_client->deleteMessage(['QueueUrl' => $queue_url, 'ReceiptHandle' => $receipt_handle]);
0

Source: https://habr.com/ru/post/1537291/


All Articles