Skip to content

[Messenger] Add options for PostgreSQL LISTEN/NOTIFY support #15043

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
Apr 7, 2021
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
32 changes: 28 additions & 4 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,12 @@ a table named ``messenger_messages``.
Or, to create the table yourself, set the ``auto_setup`` option to ``false`` and
:ref:`generate a migration <doctrine-creating-the-database-tables-schema>`.

.. caution::

The datetime property of the messages stored in the database uses the
timezone of the current system. This may cause issues if multiple machines
with different timezone configuration use the same storage.

The transport has a number of options:

================== ===================================== ======================
Expand All @@ -1093,11 +1099,28 @@ auto_setup Whether the table should be created
automatically during send / get. true
================== ===================================== ======================

.. caution::
.. versionadded:: 5.1

The datetime property of the messages stored in the database uses the
timezone of the current system. This may cause issues if multiple machines
with different timezone configuration use the same storage.
The ability to leverage PostgreSQL's LISTEN/NOTIFY was introduced
in Symfony 5.1.

When using PostgreSQL, you have access to the following options to leverage
the `LISTEN/NOTIFY`_ feature. This allow for a more performant approach
than the default polling behavior of the Doctrine transport because
PostgreSQL will directly notify the workers when a new message is inserted
in the table.

======================= ===================================== ======================
Option Description Default
======================= ===================================== ======================
use_notify Whether to use LISTEN/NOTIFY. true
check_delayed_interval The interval to check for delayed 1000
messages, in milliseconds.
Set to 0 to disable checks.
get_notify_timeout The length of time to wait for a 0
response when calling
``PDO::pgsqlGetNotify```, in milliseconds.
======================= ========================================== ======================

Beanstalkd Transport
~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1971,3 +1994,4 @@ Learn more
.. _`Long polling`: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html
.. _`Visibility Timeout`: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
.. _`FIFO queue`: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
.. _`LISTEN/NOTIFY`: https://www.postgresql.org/docs/current/sql-notify.html