Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitab061f9

Browse files
[FrameworkBundle] MakeStopWorkerOnSignalsListener configurable via messenger's config
1 parent6009b8f commitab061f9

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

‎messenger.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
<containerxmlns="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-signalssignal="SIGINT"/>
804+
<framework:stop-worker-on-signalssignal="SIGTERM"/>
805+
<framework:stop-worker-on-signalssignal="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
772826
a Docker container having Supervisor as its entrypoint). In these cases you
773827
need to add a ``stopwaitsecs`` key to the program configuration (with a value

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp