@@ -711,51 +711,9 @@ states to prevent information and/or memory leakage.
711
711
712
712
However, certain Symfony services, such as the Monolog
713
713
:ref: `fingers crossed handler <logging-handler-fingers_crossed >`, leak by design.
714
- In those cases, use the ``reset_on_message `` transport option to automatically
715
- reset the service container between two messages:
716
-
717
- .. configuration-block ::
718
-
719
- .. code-block :: yaml
720
-
721
- # config/packages/messenger.yaml
722
- framework :
723
- messenger :
724
- reset_on_message : true
725
- transports :
726
- async :
727
- dsn : ' %env(MESSENGER_TRANSPORT_DSN)%'
728
-
729
- .. code-block :: xml
730
-
731
- <!-- config/packages/messenger.xml -->
732
- <?xml version =" 1.0" encoding =" UTF-8" ?>
733
- <container xmlns =" http://symfony.com/schema/dic/services"
734
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
735
- xmlns : framework =" http://symfony.com/schema/dic/symfony"
736
- xsi : schemaLocation =" http://symfony.com/schema/dic/services
737
- https://symfony.com/schema/dic/services/services-1.0.xsd
738
- http://symfony.com/schema/dic/symfony
739
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
740
-
741
- <framework : config >
742
- <framework : messenger reset-on-message =" true" >
743
- <framework : transport name =" async" dsn =" %env(MESSENGER_TRANSPORT_DSN)%" >
744
- </framework : transport >
745
- </framework : messenger >
746
- </framework : config >
747
- </container >
748
-
749
- .. code-block :: php
750
-
751
- // config/packages/messenger.php
752
- use Symfony\Config\FrameworkConfig;
753
-
754
- return static function (FrameworkConfig $framework) {
755
- $messenger = $framework->messenger();
756
-
757
- $messenger->resetOnMessage(true);
758
- };
714
+ That's why, by default, the service container is reset between consuming messages.
715
+ To disable this behavior, execute the ``messenger:consume `` command with the
716
+ ``--no-reset `` option.
759
717
760
718
.. _messenger-retries-failures :
761
719
0 commit comments