I
I
Igor2021-08-28 00:51:28
symfony
Igor, 2021-08-28 00:51:28

Messenger: Sync & Queued Message Handling?

I wanted to fasten a simple queue, I have no experience in this.
But it already becomes necessary in some cases.

For example, generating report files, which can take a long time.

I started playing with Messenger: Sync & Queued Message Handling I
chose Redis as a transport.

Symfony has three lines of code.
And it seems like everything worked asynchronously, as I wanted.

Just in case, I read it to the doc...
And added this.

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']


But after some time, this appeared

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 { …}]


And yes, I tried to install composer require symfony/proxy-manager-bridge
it. It did not give any effect, but only completely broke the project.

I would like to understand what I did wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question