Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ping/close connection middleware services #956

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions Resources/config/messenger.xml
Expand Up @@ -12,6 +12,22 @@
<argument type="service" id="doctrine" />
</service>

<!--
The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
the "doctrine_ping_connection" shortcut in message buses middleware config
-->
<service id="messenger.middleware.doctrine_ping_connection" class="Symfony\Bridge\Doctrine\Messenger\DoctrinePingConnectionMiddleware" abstract="true" public="false">
<argument type="service" id="doctrine" />
</service>

<!--
The following service isn't prefixed by the "doctrine.orm" namespace in order for end-users to just use
the "doctrine_close_connection" shortcut in message buses middleware config
-->
<service id="messenger.middleware.doctrine_close_connection" class="Symfony\Bridge\Doctrine\Messenger\DoctrineCloseConnectionMiddleware" abstract="true" public="false">
<argument type="service" id="doctrine" />
</service>

<!--
The following service isn't tagged as transport factory because the class may not exist.
The tag is added conditionally in DoctrineExtension.
Expand Down
4 changes: 4 additions & 0 deletions Tests/DependencyInjection/DoctrineExtensionTest.php
Expand Up @@ -663,6 +663,10 @@ public function testMessengerIntegration()

$this->assertNotNull($middlewarePrototype = $container->getDefinition('messenger.middleware.doctrine_transaction'));
$this->assertCount(1, $middlewarePrototype->getArguments());
$this->assertNotNull($middlewarePrototype = $container->getDefinition('messenger.middleware.doctrine_ping_connection'));
$this->assertCount(1, $middlewarePrototype->getArguments());
$this->assertNotNull($middlewarePrototype = $container->getDefinition('messenger.middleware.doctrine_close_connection'));
alcaeus marked this conversation as resolved.
Show resolved Hide resolved
$this->assertCount(1, $middlewarePrototype->getArguments());
}

/**
Expand Down