Skip to content

Commit

Permalink
NEXT-31249 - add warning for lower shopware versions than 6.5.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MoritzKrafeld committed Oct 25, 2023
1 parent c1bad92 commit f80b463
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
12 changes: 11 additions & 1 deletion guides/hosting/infrastructure/message-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ nav:

## Overview

::: warning
This guide contains the `async_low_priority` queue which is only available in version 6.5.7.0 and above. You must not configure this queue in older versions as the messenger:consume command will fail.
:::

Shopware uses the Symfony Messenger component and Enqueue to handle asynchronous messages. This allows tasks to be processed in the background. Thus, tasks can be processed independently of timeouts or system crashes. By default, tasks in Shopware are stored in the database and processed via the browser as long as you are logged into the Administration. This is a simple and fast method for the development process, but not recommended for production systems. With multiple users logged into the Administration, this can lead to a high CPU load and interfere with the smooth execution of PHP FPM.

## Message queue on production systems
Expand Down Expand Up @@ -41,7 +45,9 @@ You can configure the command just to run a certain amount of time and to stop i
bin/console messenger:consume async --time-limit=60 --memory-limit=128M
```

You can also configure the command to consume messages from multiple transports as it is recommended:
You can also configure the command to consume messages from multiple transports, in order to prioritize them to your needs, as it is recommended by the [Symfony documentation](https://symfony.com/doc/current/messenger.html#prioritized-transports):

```bash

```bash
bin/console messenger:consume async async_low_priority
Expand Down Expand Up @@ -114,6 +120,10 @@ Please refer to the [Symfony documentation](https://symfony.com/doc/current/mess

### Admin worker

::: warning
The `transports` option can only be configured with the `async_low_priority` transport if you are on version 6.5.7.0 or above. You must not the `async_low_priority` in lower versions as the admin worker will fail.
:::

The admin worker, if used, can be configured in the general `shopware.yml` configuration. If you want to use the admin worker, you have to specify each transport that was previously configured. The poll interval is the time in seconds that the admin worker polls messages from the queue. After the poll interval is over, the request terminates, and the Administration initiates a new request.

```yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ nav:

## Overview

::: warning
This guide contains the `async_low_priority` queue which is only available in version 6.5.7.0 and above. You must not configure this queue in older versions as the messenger:consume command will fail.
:::

In this guide you'll learn how to create a message handler.

A [handler](https://symfony.com/doc/current/messenger.html#creating-a-message-handler) gets called once the message is dispatched by the `handle_messages` middleware. Handlers do the actual processing of the message.
Expand Down Expand Up @@ -49,7 +53,7 @@ There is a console command to start a worker that will receive incoming messages
bin/console messenger:consume async
```

You can also append more transports to the command, so the worker will consume messages from multiple transports:
You can also append more transports to the command, so the worker will consume messages from multiple transports which will result in prioritisation as mentioned in [Prioritized Transports](https://symfony.com/doc/current/messenger.html#prioritized-transports):

```bash
//
Expand Down Expand Up @@ -171,6 +175,10 @@ You can route messages by their classname and use the asterisk as a fallback for

### Admin worker

::: warning
The `transports` option can only be configured with the `async_low_priority` transport if you are on version 6.5.7.0 or above. You must not the `async_low_priority` in lower versions as the admin worker will fail.
:::

The admin-worker can be configured or disabled in the general `shopware.yml` configuration. If you want to use the admin worker you have to specify each transport, that previously was configured. The poll interval is the time in seconds that the admin-worker polls messages from the queue. After the poll-interval is over the request terminates and the Administration initiates a new request.

```yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ nav:

## Overview

::: warning
This guide contains the `async_low_priority` queue which is only available in version 6.5.7.0 and above. You must not configure this queue in older versions as the messenger:consume command will fail.
:::

In this guide you will learn how to handle asynchronous messages and the difference between the asynchronous queues.

## Prerequisites
Expand All @@ -17,9 +21,9 @@ This guide is built upon the [Add message to queue guide](add-message-to-queue),

## Different queues

Currently, there are two different queues for asynchronous messages. The first one is the "async" queue which can be used if a message implements the `AsyncMessageInterface` as mentioned in [Create a message](add-message-to-queue#create-a-message).
Currently, there are two different queues for asynchronous messages which allow us to have different prioritized queues as mentioned in [Prioritized Transports](https://symfony.com/doc/current/messenger.html#prioritized-transports). The first one is the `async` queue which can be used if a message implements the `AsyncMessageInterface` as mentioned in [Create a message](add-message-to-queue#create-a-message).

The second queue is the "async_low_priority" queue which will also handle the messages asynchronously, but with a lower priority, as this queue should be handled once the "async" queue is empty. This queue can be used if a message implements the `AsyncLowPriorityMessageInterface`.
The second queue is the `async_low_priority` queue which will also handle the messages asynchronously, but with a lower priority, as this queue should be handled once the `async` queue is empty. This queue can be used if a message implements the `AsyncLowPriorityMessageInterface`.

Here's an example:

Expand Down Expand Up @@ -49,7 +53,7 @@ class EmailNotification implements AsyncLowPriorityMessageInterface

## Retry strategies

Both queues have the same retry strategy. If a message fails to be handled, it will be retried up to 3 times with a starting delay of 1 second, doubling after each retry. After the third retry, the message will be moved to the "failed" queue.
Both queues have the same retry strategy. If a message fails to be handled, it will be retried up to 3 times with a starting delay of 1 second, doubling after each retry. After the third retry, the message will be moved to the `failed` queue.

## More interesting topics

Expand Down

0 comments on commit f80b463

Please sign in to comment.