10000 [Messenger] Deprecate the reset_on_message option by javiereguiluz · Pull Request #16645 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Messenger] Deprecate the reset_on_message option #16645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Messenger] Deprecate the reset_on_message option
  • Loading branch information
javiereguiluz committed Mar 24, 2022
commit bd94a2d045831f635a901b99c439f031ec92f219
50 changes: 7 additions & 43 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -711,51 +711,15 @@ states to prevent information and/or memory leakage.

However, certain Symfony services, such as the Monolog
:ref:`fingers crossed handler <logging-handler-fingers_crossed>`, leak by design.
In those cases, use the ``reset_on_message`` transport option to automatically
reset the service container between two messages:
That's why Symfony automatically resets the service container between two messages.
If you don't want to reset the container, add the ``--no-reset`` option when
running the ``messenger:consume`` command.

.. configuration-block::

.. code-block:: yaml

# config/packages/messenger.yaml
framework:
messenger:
reset_on_message: true
transports:
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
.. deprecated:: 6.1

.. code-block:: xml

<!-- config/packages/messenger.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:messenger>
<framework:transport name="async" dsn="%env(MESSENGER_TRANSPORT_DSN)%" reset-on-message="true">
</framework:transport>
</framework:messenger>
</framework:config>
</container>

.. code-block:: php

// config/packages/messenger.php
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
$messenger = $framework->messenger();

$messenger->resetOnMessage(true);
};
In Symfony versions previous to 6.1, the service container didn't reset
automatically between messages and you had to set the
``framework.messenger.reset_on_message`` option to ``true``.

.. _messenger-retries-failures:

Expand Down
0