Skip to content

Commit 04a2203

Browse files
[FrameworkBundle] Make StopWorkerOnSignalsListener configurable via messenger's config
1 parent 6009b8f commit 04a2203

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

messenger.rst

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,59 @@ message before terminating.
762762

763763
However, you might prefer to use different POSIX signals for graceful shutdown.
764764
You can override default ones by setting the ``framework.messenger.stop_worker_on_signals``
765-
configuration option.
765+
configuration option:
766+
767+
.. configuration-block::
768+
769+
.. code-block:: yaml
770+
771+
# config/packages/messenger.yaml
772+
framework:
773+
messenger:
774+
stop_worker_on_signals:
775+
- "SIGINT"
776+
- "SIGTERM"
777+
- "SIGUSR1"
778+
779+
# ...
780+
781+
.. code-block:: xml
782+
783+
<!-- config/packages/messenger.xml -->
784+
<?xml version="1.0" encoding="UTF-8" ?>
785+
<container xmlns="http://symfony.com/schema/dic/services"
786+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
787+
xmlns:framework="http://symfony.com/schema/dic/symfony"
788+
xsi:schemaLocation="http://symfony.com/schema/dic/services
789+
https://symfony.com/schema/dic/services/services-1.0.xsd
790+
http://symfony.com/schema/dic/symfony
791+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
792+
793+
<framework:config>
794+
<framework:messenger>
795+
<!-- ... -->
796+
797+
<framework:stop-worker-on-signals signal="SIGINT"/>
798+
<framework:stop-worker-on-signals signal="SIGTERM"/>
799+
<framework:stop-worker-on-signals signal="SIGUSR1"/>
800+
</framework:messenger>
801+
</framework:config>
802+
</container>
803+
804+
.. code-block:: php
805+
806+
use Symfony\Config\FrameworkConfig;
807+
808+
return static function (FrameworkConfig $framework) {
809+
$messenger = $framework->messenger();
810+
811+
// ...
812+
813+
$messenger
814+
->stopWorkerOnSignals([\SIGINT, \SIGTERM, \SIGUSR1])
815+
// ...
816+
;
817+
};
766818
767819
.. versionadded:: 6.3
768820

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy