@@ -848,7 +848,56 @@ message before terminating.
848
848
849
849
However, you might prefer to use different POSIX signals for graceful shutdown.
850
850
You can override default ones by setting the ``framework.messenger.stop_worker_on_signals ``
851
- configuration option.
851
+ configuration option:
852
+
853
+ .. configuration-block ::
854
+
855
+ .. code-block :: yaml
856
+
857
+ # config/packages/messenger.yaml
858
+ framework :
859
+ messenger :
860
+ stop_worker_on_signals :
861
+ - SIGTERM
862
+ - SIGINT
863
+ - SIGUSR1
864
+
865
+ .. code-block :: xml
866
+
867
+ <!-- config/packages/messenger.xml -->
868
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
869
+ <container xmlns =" http://symfony.com/schema/dic/services"
870
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
871
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
872
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
873
+ https://symfony.com/schema/dic/services/services-1.0.xsd
874
+ http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
875
+
876
+ <framework : config >
877
+ <framework : messenger >
878
+ <!-- ... -->
879
+ <framework : stop-worker-on-signal >SIGTERM</framework : stop-worker-on-signal >
880
+ <framework : stop-worker-on-signal >SIGINT</framework : stop-worker-on-signal >
881
+ <framework : stop-worker-on-signal >SIGUSR1</framework : stop-worker-on-signal >
882
+ </framework : messenger >
883
+ </framework : config >
884
+ </container >
885
+
886
+ .. code-block :: php
887
+
888
+ // config/packages/messenger.php
889
+ use Symfony\Config\FrameworkConfig;
890
+
891
+ return static function (FrameworkConfig $framework): void {
892
+ $framework->messenger()
893
+ ->stopWorkerOnSignals(['SIGTERM', 'SIGINT', 'SIGUSR1']);
894
+ };
895
+
896
+ .. versionadded :: 7.3
897
+
898
+ Support for signals plain name in configuration was introduced in Symfony 7.3.
899
+ Prior to this, you had to use the numeric values of the signals as defined
900
+ in the ``pcntl `` extension's `predefined constants `_.
852
901
853
902
In some cases the ``SIGTERM `` signal is sent by Supervisor itself (e.g. stopping
854
903
a Docker container having Supervisor as its entrypoint). In these cases you
@@ -3587,3 +3636,4 @@ Learn more
3587
3636
.. _`high connection churn` : https://www.rabbitmq.com/connections.html#high-connection-churn
3588
3637
.. _`article about CQRS` : https://martinfowler.com/bliki/CQRS.html
3589
3638
.. _`SSL context options` : https://php.net/context.ssl
3639
+ .. _`predefined constants` : https://www.php.net/pcntl.constants
0 commit comments