wesmahler's avatar

Test Queue Connection Works for Healthcheck

How can I test to make sure the queue connection works?

I want to add this test to our production's healthcheck file. We want it to check to make sure the QUEUE connection is working. Without having to dispatch a job.

0 likes
2 replies
bobbybouwmann's avatar

As far as I know the only way is to send a simply job to it and make it return something or make that job call some url in your application.

Well after thinking about it for a while I think instead of dispatching a job you can simply ask for all the jobs or keys that are available. It will always give you back an array which might be empty, but at least you will get a response back.

Since Laravel 5.4 you can use the size method on the Queue facade. So something like this

Queue::size();

Documentation: https://laravel.com/api/5.6/Illuminate/Contracts/Queue/Queue.html

Please or to participate in this conversation.