From 885e42d4fa5f734c1efa5c4ab3ed8f375d433379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 3 Aug 2021 18:01:49 +0200 Subject: [PATCH] [Messenger] Document StopWorkerException --- messenger.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/messenger.rst b/messenger.rst index eb83a48903a..635b336f771 100644 --- a/messenger.rst +++ b/messenger.rst @@ -461,6 +461,17 @@ The first argument is the receiver's name (or service id if you routed to a custom service). By default, the command will run forever: looking for new messages on your transport and handling them. This command is called your "worker". +.. tip:: + + To properly stop a worker, throw an instance of + :class:`Symfony\\Component\\Messenger\\Exception\\StopWorkerException`. + + .. versionadded:: 5.4 + + The :class:`Symfony\\Component\\Messenger\\Exception\\StopWorkerException` + class was introduced in Symfony 5.4. + + Deploying to Production ~~~~~~~~~~~~~~~~~~~~~~~