Description
Description
Since workers are launched to consume a specific receiver, an analogue is needed to stop a specific receiver. That is, messenger:consume
by itself is invalid: it must accept the name of one or more receivers to start working. A command to stop specific workers, however, is not available.
This is a problem since we expect to write system services to start workers. That is, I may define foo.service
and bar.service
for systemd, which may look like the following.
# foo.service
[Service]
Restart=on-failure
ExecStart='bin/console' -vv messenger:consume foo
ExecStop='bin/console' messenger:stop-workers
This works fine for one service, but the interaction between the two is counter-intuitive. If I start foo.service
and bar.service
, both are running and all is well. But if I restart foo.service
, both services stop but only foo.service
comes back up.
One might argue that because workers can consume multiple receivers it is not very practical to write an analogue that can stop specific receivers, the only valid way to interact with a running worker is to target specific workers, but there appears to be no mechanism to do this in a safe way. By safe, I mean the worker must be allowed to finish processing any pending job before terminating. One way to do this might be with signals. However, unless the worker process is designed specifically to handle a custom graceful shutdown signal, any such signals will either cause the program to terminate immediately, in an unsafe manner, or do nothing at all. Judging from the documentation, sending signals to workers is not supported presently.
Example
No response