You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7-11Lines changed: 7 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -6,38 +6,34 @@ CHANGELOG
6
6
7
7
* The component is not experimental anymore
8
8
* All the changes below are BC BREAKS
9
+
* Senders and handlers subscribing to parent interfaces now receive *all* matching messages, wildcard included
9
10
*`MessageBusInterface::dispatch()`, `MiddlewareInterface::handle()` and `SenderInterface::send()` return `Envelope`
10
11
*`MiddlewareInterface::handle()` now require an `Envelope` as first argument and a `StackInterface` as second
11
12
*`EnvelopeAwareInterface` has been removed
12
13
* The signature of `Amqp*` classes changed to take a `Connection` as a first argument and an optional
13
14
`Serializer` as a second argument.
14
-
*`SenderLocator` has been renamed to `ContainerSenderLocator`
15
-
Be careful as there is still a `SenderLocator` class, but it does not rely on a `ContainerInterface` to find senders.
16
-
Instead, it accepts the sender instance itself instead of its identifier in the container.
17
15
*`MessageSubscriberInterface::getHandledMessages()` return value has changed. The value of an array item
18
16
needs to be an associative array or the method name.
19
17
*`StampInterface` replaces `EnvelopeItemInterface` and doesn't extend `Serializable` anymore
20
18
* The `ConsumeMessagesCommand` class now takes an instance of `Psr\Container\ContainerInterface`
21
19
as first constructor argument
22
20
* The `EncoderInterface` and `DecoderInterface` have been replaced by a unified `Symfony\Component\Messenger\Transport\Serialization\SerializerInterface`.
23
-
* The locator passed to `ContainerHandlerLocator` should not prefix its keys by "handler." anymore
24
-
* The `AbstractHandlerLocator::getHandler()` method uses `?callable` as return type
25
21
* Renamed `EnvelopeItemInterface` to `StampInterface`
26
22
*`Envelope`'s constructor and `with()` method now accept `StampInterface` objects as variadic parameters
27
23
* Renamed and moved `ReceivedMessage`, `ValidationConfiguration` and `SerializerConfiguration` in the `Stamp` namespace
28
-
* Removed the `WrapIntoReceivedMessage`
29
-
*`SenderLocatorInterface::getSenderForMessage()` has been replaced by `getSender(Envelope $envelope)`
24
+
* Removed the `WrapIntoReceivedMessage` class
30
25
*`MessengerDataCollector::getMessages()` returns an iterable, not just an array anymore
31
-
*`AbstractHandlerLocator` is now internal
32
-
*`HandlerLocatorInterface::resolve()` has been replaced by `getHandler(Envelope $envelope): ?callable` and shouldn't throw when no handlers are found
33
-
*`SenderLocatorInterface::getSenderForMessage()` has been replaced by `getSender(Envelope $envelope)`
26
+
*`HandlerLocatorInterface::resolve()` has been removed, use `HandlersLocator::getHandlers()` instead
27
+
*`SenderLocatorInterface::getSenderForMessage()` has been removed, use `SendersLocator::getSenders()` instead
34
28
* Classes in the `Middleware\Enhancers` sub-namespace have been moved to the `Middleware` one
35
29
* Classes in the `Asynchronous\Routing` sub-namespace have been moved to the `Transport\Sender\Locator` sub-namespace
36
30
* The `Asynchronous/Middleware/SendMessageMiddleware` class has been moved to the `Middleware` namespace
37
-
*`SenderInterface` and `ChainSender` classes have been moved to the `Transport\Sender` sub-namespace
31
+
*`SenderInterface` has been moved to the `Transport\Sender` sub-namespace
32
+
* The `ChainHandler` and `ChainSender` classes have been removed
38
33
*`ReceiverInterface` and its implementations have been moved to the `Transport\Receiver` sub-namespace
39
34
*`ActivationMiddlewareDecorator` has been renamed `ActivationMiddleware`
40
35
*`AllowNoHandlerMiddleware` has been removed in favor of a new constructor argument on `HandleMessageMiddleware`
36
+
* The `ContainerHandlerLocator`, `AbstractHandlerLocator`, `SenderLocator` and `AbstractSenderLocator` classes have been removed
$messageClassLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : $r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method);
112
+
$messageLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : $r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method);
120
113
121
-
thrownewRuntimeException(sprintf('Invalid configuration %s for message "%s": bus "%s" does not exist.', $messageClassLocation, $messageClass, $method['bus']));
114
+
thrownewRuntimeException(sprintf('Invalid configuration %s for message "%s": bus "%s" does not exist.', $messageLocation, $message, $method['bus']));
122
115
}
123
116
124
117
$buses = array($method['bus']);
125
118
}
126
119
127
-
if (isset($method['priority'])) {
128
-
$messagePriority = $method['priority'];
129
-
}
130
-
120
+
$priority = $method['priority'] ?? $priority;
131
121
$method = $method['method'] ?? '__invoke';
132
122
}
133
123
134
-
if (!\class_exists($messageClass) && !\interface_exists($messageClass, false)) {
135
-
$messageClassLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : $r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method);
124
+
if ('*' !== $message && !class_exists($message) && !interface_exists($message, false)) {
125
+
$messageLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : $r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method);
136
126
137
-
thrownewRuntimeException(sprintf('Invalid handler service "%s": message class "%s" %s does not exist.', $serviceId, $messageClass, $messageClassLocation));
127
+
thrownewRuntimeException(sprintf('Invalid handler service "%s": class or interface "%s" %s not found.', $serviceId, $message, $messageLocation));
138
128
}
139
129
140
130
if (!$r->hasMethod($method)) {
@@ -144,15 +134,19 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
thrownewRuntimeException(sprintf('Invalid handler service "%s": method "%s::getHandledMessages()" must return one or more messages.', $serviceId, $r->getName()));
149
+
}
156
150
}
157
151
}
158
152
@@ -165,29 +159,24 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
if ($handlerClass->implementsInterface(MessageSubscriberInterface::class)) {
209
-
if (!$handledMessages = $handlerClass->getName()::getHandledMessages()) {
210
-
thrownewRuntimeException(sprintf('Invalid handler service "%s": method "%s::getHandledMessages()" must return one or more messages.', $serviceId, $handlerClass->getName()));
0 commit comments