We run our messenger consumer in a kubernetes cluster. For the pod I want to setup a liveness probe. So kubernetes will do some sort of check inside the pod to see if it is still running.
An easy way to do this is to write a file somewhere and then kubernetes checks if this file exists. Removes it, sleeps a bit and then checks again if the file is created.
For this I need to do be able to have a place that can write a file, even when no messages arrive. The Worker class is a suitable place because inside the run function the $onHandledCallback is constantly being called with a short sleep.
The problem is that you cannot add your own Worker or $onHandledCallback currently in the ConsumeMessagesCommand.
I would like to propose that you can add a custom $onHandledCallback or a custom set of Workers to the constructor of the ConsumeMessagesCommand.