Skip to content

[Messenger] Keepalive support for Doctrine & Redis #20721

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 10, 2025
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
18 changes: 12 additions & 6 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ the message from being redelivered until the worker completes processing it:

.. note::

This option is only available for the following transports: Beanstalkd and AmazonSQS.
This option is only available for the following transports: Beanstalkd, AmazonSQS, Doctrine and Redis.

.. versionadded:: 7.2

Expand Down Expand Up @@ -1745,13 +1745,12 @@ in the table.
The length of time to wait for a response when calling
``PDO::pgsqlGetNotify``, in milliseconds.

The keepalive feature, which prevents messages from being prematurely redelivered during
long-running processing, updates the ``delivered_at`` timestamp periodically to ensure
the message is marked as "in progress".
Comment on lines -1748 to -1750
Copy link
Member Author

@HypeMC HypeMC Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed since no other transport has an explanation of how the keepalive mechanism is implemented and I'm not sure it's even relevant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is an implementation detail, it could be helpful to understand the how, that said, its ok for me to remove it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add a similar explanation for each transport that has the keepalive mechanism implemented?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, see #20736 for 7.2

The Doctrine transport supports the ``--keepalive`` option by periodically updating
the ``delivered_at`` timestamp to prevent the message from being redelivered.

.. versionadded:: 7.3

Keepalive support, using the ``--keepalive`` option, was introduced in Symfony 7.3.
Keepalive support was introduced in Symfony 7.3.

Beanstalkd Transport
~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1802,7 +1801,7 @@ The Beanstalkd transport supports the ``--keepalive`` option by using Beanstalkd
Keepalive support was introduced in Symfony 7.2.

The Beanstalkd transport lets you set the priority of the messages being dispatched.
Use the :class:``Symfony\\Component\\Messenger\\Bridge\\Beanstalkd\\Transport\\BeanstalkdPriorityStamp``
Use the :class:``Symfony\Component\Messenger\Bridge\Beanstalkd\Transport\BeanstalkdPriorityStamp``
and pass a number to specify the priority (default = ``1024``; lower numbers mean higher priority)::

use App\Message\SomeMessage;
Expand Down Expand Up @@ -1951,6 +1950,13 @@ under the transport in ``messenger.yaml``:
in your case) to avoid memory leaks. Otherwise, all messages will remain
forever in Redis.

The Redis transport supports the ``--keepalive`` option by using Redis's ``XCLAIM``
command to periodically reset the message's idle time to zero.

.. versionadded:: 7.3

Keepalive support was introduced in Symfony 7.3.

In Memory Transport
~~~~~~~~~~~~~~~~~~~

Expand Down
Loading