Zend certified PHP/Magento developer

How to un CLI command during maintenance mode

I have a message queue running on an admin server. During deployments I’d like to enable maintenance mode to signal our consumers to stop dequeuing messages. The queue can remain active, but no messages will be dequeued during maintenance mode.

The second step is that we have a command that will check how many consumers are running:

php bin/magento edi:consumers:active

This will return the number of active consumers as an integer. 0 would be that we are good to deploy and will not lose messages.

My issue is that once maintenance mode is enabled, I can no longer run my commands via CLI:

There are no commands defined in the "edi:consumers" namespace.

I know there are other commands that can be run when maintenance mode is enabled (maintenance:enable for example).

How can I run my edi:consumers:active command when maintenance mode is enabled?


I’m aware the Magento Docs recommend to kill consumers processes, but that isn’t an option for us because we would lose our data in the messages being consumed.