IgorPI
@IgorPI

Messenger: Sync & Queued Message Handling?

Захотел прикрутить простенькую очередь, опыта в этом нет.
Но уже становится в некоторых случая необходимо.

Например, формирование файлов отчётов, которое может занимать продолжительное время.

Начал играться с Messenger: Sync & Queued Message Handling
В качестве транспорта выбрал Redis.

В Symfony три строчки кода.
И вроде как всё заработало асинхронно, так как я и хотел.

На всякий случай дочитал доку...
И добавил это.
framework:
  messenger:
    # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
    failure_transport: failed

    buses:
      command_bus:
        middleware:
          # each time a message is handled, the Doctrine connection
          # is "pinged" and reconnected if it's closed. Useful
          # if your workers run for a long time and the database
          # connection is sometimes lost
          - doctrine_ping_connection

          # After handling, the Doctrine connection is closed,
          # which can free up database connections in a worker,
          # instead of keeping them open forever
          - doctrine_close_connection

          # wraps all handlers in a single Doctrine transaction
          # handlers do not need to call flush() and an error
          # in any handler will cause a rollback
          # - doctrine_transaction

          # or pass a different entity manager to any
          #- doctrine_transaction: ['custom']


Но по истечении некоторого времени появилось вот это

15:04:39 CRITICAL  [messenger] Error thrown while handling message Src\Message\CalculateTaskPendingCount. Removing from transport after 3 retries. Error: "Resetting a non-lazy manager service is not supported. Try running "composer require symfony/proxy-manager-bridge"." ["message" => Src\Message\CalculateTaskPendingCount { …},"class" => "Src\Message\CalculateTaskPendingCount","retryCount" => 3,"error" => "Resetting a non-lazy manager service is not supported. Try running "composer require symfony/proxy-manager-bridge".","exception" => LogicException { …}]


И да, я пробовал устанавливать composer require symfony/proxy-manager-bridge
Это не дало не какого эффекта, а только сломало полностью проект.

Хотелось бы понять, что я не так сделал.
  • Вопрос задан
  • 245 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы