@@ -768,6 +768,60 @@ configuration option.
768768
769769 The ``framework.messenger.stop_worker_on_signals `` option was introduced in Symfony 6.3.
770770
771+ You can configure the signals for which the worker will stop if received:
772+
773+ .. configuration-block ::
774+
775+ .. code-block :: yaml
776+
777+ # config/packages/messenger.yaml
778+ framework :
779+ messenger :
780+ stop_worker_on_signals :
781+ - SIGINT
782+ - SIGTERM
783+ - SIGUSR1
784+
785+ # ...
786+
787+ .. code-block :: xml
788+
789+ <!-- config/packages/messenger.xml -->
790+ <?xml version =" 1.0" encoding =" UTF-8" ?>
791+ <container xmlns =" http://symfony.com/schema/dic/services"
792+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
793+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
794+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
795+ https://symfony.com/schema/dic/services/services-1.0.xsd
796+ http://symfony.com/schema/dic/symfony
797+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
798+
799+ <framework : config >
800+ <framework : messenger >
801+ <!-- ... -->
802+
803+ <framework : stop-worker-on-signals signal =" SIGINT" />
804+ <framework : stop-worker-on-signals signal =" SIGTERM" />
805+ <framework : stop-worker-on-signals signal =" SIGUSR1" />
806+ </framework : messenger >
807+ </framework : config >
808+ </container >
809+
810+ .. code-block :: php
811+
812+ use Symfony\Config\FrameworkConfig;
813+
814+ return static function (FrameworkConfig $framework) {
815+ $messenger = $framework->messenger();
816+
817+ // ...
818+
819+ $messenger
820+ ->stopWorkerOnSignals([\SIGINT, \SIGTERM, \SIGUSR1])
821+ // ...
822+ ;
823+ };
824+
771825 In some cases the ``SIGTERM `` signal is sent by Supervisor itself (e.g. stopping
772826a Docker container having Supervisor as its entrypoint). In these cases you
773827need to add a ``stopwaitsecs `` key to the program configuration (with a value
0 commit comments