Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04a2203

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

File tree

1 file changed

+53
-1
lines changed
Filter options

1 file changed

+53
-1
lines changed

‎messenger.rst

Copy file name to clipboardExpand all lines: messenger.rst
+53-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.