Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Use Doctrine middleware by default #34073

Closed
@weaverryan

Description

@weaverryan

Description
After #34066, the Doctrine middleware should now work nicely.

In fact, I think that the "clear entity manager" and "ping connection" middleware should ALWAYS be used (assuming Doctrine is installed). Both of these are very sensible things to do to make sure the database connection is alive and that data in the entity manager isn't "stale" because it's being stored in an identity map that was added to via a message handled 10 minutes ago.

There are 2 tricky parts to this:

  1. The services for those middleware are added via DoctrineBundle... but the default middleware need to be added in FrameworkExtension.

  2. Would we do it for all entity managers? I think that could (in https://github.com/symfony/symfony/blob/4.4/src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php) cause connections to be made to all connections, even if a connection wasn't previously open (though, that could be fixed by only pinging a connection if $connection->isConnected()).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions