8000 Event bus by mvrhov · Pull Request #4 · sroze/symfony · GitHub
[go: up one dir, main page]

Skip to content

Event bus #4

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

Open
wants to merge 16 commits into
base: add-message-component
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename Producer -> Sender in the FrameworkBundle as well
  • Loading branch information
sroze committed Dec 24, 2017
commit dd0d640d44bbeb5434edf4bf2d7376d6d479825e
Original file line number Diff line number Diff line change
Expand Up @@ -911,11 +911,11 @@ private function addMessageSection(ArrayNodeDefinition $rootNode)
->beforeNormalization()
->ifString()
->then(function ($v) {
return array('producers' => array($v));
return array('senders' => array($v));
})
->end()
->children()
->arrayNode('producers')
->arrayNode('senders')
->requiresAtLeastOneElement()
->prototype('scalar')->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1367,14 +1367,14 @@ private function registerMessageConfiguration(array $config, ContainerBuilder $c
{
$loader->load('message.xml');

$messageToProducerMapping = array();
$messageToSenderMapping = array();
foreach ($config['routing'] as $message => $messageConfiguration) {
$messageToProducerMapping[$message] = array_map(function (string $serviceName) {
$messageToSenderMapping[$message] = array_map(function (string $serviceName) {
return new Reference($serviceName);
}, $messageConfiguration['producers']);
}, $messageConfiguration['senders']);
}

$container->getDefinition('message.asynchronous.routing.producer_for_message_resolver')->setArgument(0, $messageToProducerMapping);
$container->getDefinition('message.asynchronous.routing.sender_locator')->setArgument(0, $messageToSenderMapping);
}

private function registerCacheConfiguration(array $config, ContainerBuilder $container)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
</service>

<!-- Asynchronous -->
<service id="message.asynchronous.routing.producer_for_message_resolver" class="Symfony\Component\Message\Asynchronous\Routing\SenderLocator">
<argument type="collection" /> <!-- Message to producer mapping -->
<service id="message.asynchronous.routing.sender_locator" class="Symfony\Component\Message\Asynchronous\Routing\SenderLocator">
<argument type="collection" /> <!-- Message to sender mapping -->
</service>
<service id="message.asynchronous.middleware.send_message_to_producer" class="Symfony\Component\Message\Asynchronous\Middleware\SendMessageToProducersMiddleware">
<argument type="service" id="message.asynchronous.routing.producer_for_message_resolver" />
<argument type="service" id="message.asynchronous.routing.sender_locator" />

<tag name="message_middleware" priority="-5" />
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private function findHandlers(ContainerBuilder $container): array
}

$parameters = $method->getParameters();
if (count($parameters) !== 1) {
if (1 !== count($parameters)) {
throw new RuntimeException(sprintf('`__invoke` function of service "%s" must have exactly one parameter', $serviceId));
}

Expand Down
0