join the prijm community

prijm is a community of people, just like you helping each other.
join them, it only takes a minute :)

how to trigger queues without using php artisan commands in laravel?


#askrakibtg 

Hello!

Your way of explaining the video is splendid. I request you to tell me how to trigger queues without using php artisan commands in laravel!

thank you

2 2
2 replies and 1 comment

Hi @Sowmya thanks for your question. I would guess a solution for you as I haven't implemented this yet! Here is my rough idea:

Lets say you have created a queue called "ProcessVideo", then you can create a controller like "ProcessVideoController" and map it to a route file so that you can send a HTTP request to it.

In the controller write a method lets call that "runQueue", now all you have to do is to dispatch the queue in that method, like this:

ProcessPodcast::dispatch($podcast);

Now, route that controller and its method to a url. Eg. /dispatch/process-video

Now, when ever you need to dispatch the queue just send a HTTP request to the /dispatch/process-video endpoint and should eliminate the use of artisan CLI.

If you have any problem feel free to post a reply.

Let me know if that works for you, again I haven't tested it.

Thank you so much!!

If I dispatch it like this, its not working for me !

 I have used  $exitCode = Artisan::call('queue:work', [

           '--queue' => 'https://sqs.ap-south-1.amazonaws.com/180331497961/TestMail',

          '--timeout'=> 30       ]); but it is not working! Kindly tell me will it work ?ASAP.

I would be grateful if you helped me here

Sure, I would try to solve your problem. Can you please post the code in a GitHub gist and put the link here for better understanding the issue. - @rakibtg - reply - 12 Jul 2018
please login or signup to reply
post a reply
discussion resolution do more with this discussion
followed by 1 user added by 1 user save this discussion to reply later make this discussion anonymous
discussion stats
views: 381
replies: 2
favorites: 2
follower: 1
saved: 1
comments: 1