Skip to content

Commit 574e467

Browse files
committed
[Messenger] Services that need reset must implement ResetInterface
1 parent ccf38dc commit 574e467

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

messenger.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,10 @@ states to prevent information and/or memory leakage.
712712
However, certain Symfony services, such as the Monolog
713713
:ref:`fingers crossed handler <logging-handler-fingers_crossed>`, leak by design.
714714
That's why Symfony automatically resets the service container between two messages.
715+
If a service is not stateless and you want to reset its properties after each message, then
716+
the service must implement :class:`Symfony\\Contracts\\Service\\ResetInterface` where you can reset the
717+
properties in the ``reset()`` method.
718+
715719
If you don't want to reset the container, add the ``--no-reset`` option when
716720
running the ``messenger:consume`` command.
717721

0 commit comments

Comments
 (0)