From d5b17243e4beb2e165d13db8cb0c146984a323e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 15 Nov 2023 11:13:20 +0100 Subject: [PATCH] NGSTACK-805: adjust configuration --- bundle/Resources/config/messenger.yaml | 5 +---- docs/reference/asynchronous_indexing.rst | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/bundle/Resources/config/messenger.yaml b/bundle/Resources/config/messenger.yaml index 7295a1f3..cf818449 100644 --- a/bundle/Resources/config/messenger.yaml +++ b/bundle/Resources/config/messenger.yaml @@ -1,5 +1,4 @@ messenger: - reset_on_message: true transports: netgen_ibexa_search_extra_asynchronous_indexing: dsn: '%env(MESSENGER_TRANSPORT_DSN)%' @@ -46,6 +45,4 @@ messenger: 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUser': netgen_ibexa_search_extra_asynchronous_indexing default_bus: messenger.bus.default buses: - messenger.bus.default: - middleware: - - doctrine_ping_connection + messenger.bus.default: ~ diff --git a/docs/reference/asynchronous_indexing.rst b/docs/reference/asynchronous_indexing.rst index 83f03053..655c7b56 100644 --- a/docs/reference/asynchronous_indexing.rst +++ b/docs/reference/asynchronous_indexing.rst @@ -19,9 +19,28 @@ In order to enable asynchronous indexing, use the following configuration: `Default Messenger component configuration `_ will be automatically loaded. In case you want to use a different configuration, you will have to override it in the -project code. Additionally, you will need to start the consumer to process the queue. For the default configuration, -you can do that with: +project code. Note that it would be recommended to configure the bus used with ``doctrine_ping_connection`` middleware, +since the asynchronous indexing consumer will typically be a long running process, which could otherwise lose the +connection to the database. This setting is not included in the default configuration as it's a global setting and you +might not want to have it enabled by default. You can enable it in the ``buses`` part of the Messenger configuration +with: + +.. code-block:: yaml + + buses: + messenger.bus.default: + middleware: + - doctrine_ping_connection + +Additionally, you will need to start the consumer to process the queue. For the default configuration, you can do that +with: .. code-block:: console bin/console messenger:consume netgen_ibexa_search_extra_asynchronous_indexing --time-limit=1800 --limit=4096 + +.. note:: + + Event subscribers use a Messenger message bus service named ``netgen.ibexa_search_extra.asynchronous_indexing.messenger.bus``, + which is an alias to the default ``messenger.default_bus`` service. This enables override of the message bus used in + event listeners when needed.