Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commitd2b8014
committed
feature#29010 [Messenger] make senders and handlers subscribing to parent interfaces receive *all* matching messages, wildcard included (nicolas-grekas)
This PR was merged into the 4.2-dev branch.Discussion---------- [Messenger] make senders and handlers subscribing to parent interfaces receive *all* matching messages, wildcard included| Q | A| ------------- | ---| Branch? | 4.2| Bug fix? | no| New feature? | yes| BC breaks? | yes| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -~Embeds#29006 for now.~From the CHANGELOG: * senders and handlers subscribing to parent interfaces now receive *all* matching messages, wildcard included * `HandlerLocatorInterface::resolve()` has been removed, use `HandlersLocator::getHandlers()` instead * `SenderLocatorInterface::getSenderForMessage()` has been removed, use `SendersLocator::getSenders()` instead * The `ChainHandler` and `ChainSender` classes have been removed * The `ContainerHandlerLocator`, `AbstractHandlerLocator`, `SenderLocator` and `AbstractSenderLocator` classes have been removedThe new `HandlersLocatorInterface` and `SendersLocatorInterface` interfaces return **`iterable`** of corresponding handlers/senders. This allows simplifying a lot the DI configuration and standalone usage.Inheritance-based configuration is now stable: when a sender or a handler is bound to `SomeMessageInterface`, it will always get all messages of that kind. This fixes the unstable nature of the previous logic, where only the first matching type bound to a message would match, making routing/handling unpredictable (note that the new behavior is also how Laravel does it.)Some cleanups found meanwhile: * the `messenger.sender` tag was useless, it's removed * the reponsibility of the "send-and-handle" decision has been moved to the locator, where it belongs * thanks to type+argument autowiring aliases, we don't need to force defining a default bus - gaining nice errors when a named argument has a typo * some services have been renamed to make them more conventionalAs far as priorities are concerned, the priority number applies in the scope of the type bound to it: senders/handlers that are bound to more specific types are always called before less specific ones, no matter the defined priority.Commits-------1e7af4d [Messenger] make senders and handlers subscribing to parent interfaces receive *all* matching messages, wildcard includedFile tree
38 files changed
+419
-977
lines changed- src/Symfony
- Bundle/FrameworkBundle
- Controller
- DependencyInjection
- Compiler
- Resources/config
- Tests/DependencyInjection
- Fixtures
- php
- xml
- yml
- Component/Messenger
- DependencyInjection
- Handler
- Locator
- Middleware
- Tests
- DependencyInjection
- Handler
- Locator
- Middleware
- Transport
- AmqpExt/Fixtures
- Sender
- Locator
- Transport/Sender
- Locator
38 files changed
+419
-977
lines changedLines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
| 394 | + | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
| 401 | + | |
| 402 | + | |
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1077 | 1077 | | |
1078 | 1078 | | |
1079 | 1079 | | |
1080 | | - | |
| 1080 | + | |
1081 | 1081 | | |
1082 | 1082 | | |
1083 | 1083 | | |
| |||
Lines changed: 23 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
1491 | 1492 | | |
1492 | 1493 | | |
1493 | 1494 | | |
1494 | | - | |
| 1495 | + | |
1495 | 1496 | | |
1496 | 1497 | | |
1497 | 1498 | | |
| |||
1502 | 1503 | | |
1503 | 1504 | | |
1504 | 1505 | | |
1505 | | - | |
| 1506 | + | |
1506 | 1507 | | |
1507 | 1508 | | |
1508 | 1509 | | |
| |||
1517 | 1518 | | |
1518 | 1519 | | |
1519 | 1520 | | |
1520 | | - | |
1521 | | - | |
1522 | | - | |
1523 | | - | |
1524 | | - | |
| 1521 | + | |
1525 | 1522 | | |
1526 | 1523 | | |
1527 | 1524 | | |
1528 | 1525 | | |
1529 | 1526 | | |
1530 | | - | |
| 1527 | + | |
1531 | 1528 | | |
1532 | 1529 | | |
1533 | 1530 | | |
| |||
1562 | 1559 | | |
1563 | 1560 | | |
1564 | 1561 | | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
1568 | | - | |
1569 | 1562 | | |
1570 | 1563 | | |
1571 | 1564 | | |
1572 | | - | |
| 1565 | + | |
1573 | 1566 | | |
1574 | 1567 | | |
1575 | 1568 | | |
1576 | 1569 | | |
1577 | 1570 | | |
1578 | 1571 | | |
1579 | | - | |
1580 | 1572 | | |
1581 | 1573 | | |
1582 | 1574 | | |
1583 | 1575 | | |
1584 | 1576 | | |
1585 | | - | |
1586 | | - | |
| 1577 | + | |
| 1578 | + | |
1587 | 1579 | | |
1588 | 1580 | | |
1589 | | - | |
| 1581 | + | |
1590 | 1582 | | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
1591 | 1586 | | |
1592 | | - | |
1593 | | - | |
1594 | | - | |
1595 | | - | |
1596 | | - | |
1597 | | - | |
1598 | | - | |
1599 | | - | |
1600 | | - | |
1601 | | - | |
1602 | | - | |
1603 | | - | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
1604 | 1592 | | |
1605 | | - | |
| 1593 | + | |
1606 | 1594 | | |
1607 | 1595 | | |
1608 | | - | |
1609 | | - | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
1610 | 1600 | | |
1611 | 1601 | | |
1612 | 1602 | | |
| |||
Lines changed: 6 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
| 27 | + | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
Lines changed: 11 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
547 | | - | |
548 | 547 | | |
549 | | - | |
550 | 548 | | |
551 | 549 | | |
552 | 550 | | |
| |||
563 | 561 | | |
564 | 562 | | |
565 | 563 | | |
566 | | - | |
567 | | - | |
| 564 | + | |
568 | 565 | | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | 566 | | |
575 | 567 | | |
576 | 568 | | |
577 | 569 | | |
578 | 570 | | |
579 | 571 | | |
580 | | - | |
581 | | - | |
582 | | - | |
| 572 | + | |
| 573 | + | |
583 | 574 | | |
584 | 575 | | |
585 | 576 | | |
586 | 577 | | |
587 | | - | |
| 578 | + | |
588 | 579 | | |
589 | 580 | | |
590 | 581 | | |
| |||
593 | 584 | | |
594 | 585 | | |
595 | 586 | | |
596 | | - | |
| 587 | + | |
597 | 588 | | |
598 | 589 | | |
599 | 590 | | |
| |||
619 | 610 | | |
620 | 611 | | |
621 | 612 | | |
622 | | - | |
623 | | - | |
| 613 | + | |
| 614 | + | |
624 | 615 | | |
625 | 616 | | |
626 | 617 | | |
627 | 618 | | |
628 | 619 | | |
629 | 620 | | |
630 | | - | |
631 | | - | |
| 621 | + | |
| 622 | + | |
632 | 623 | | |
633 | 624 | | |
634 | 625 | | |
635 | 626 | | |
636 | | - | |
637 | | - | |
| 627 | + | |
| 628 | + | |
638 | 629 | | |
639 | 630 | | |
640 | 631 | | |
| |||
0 commit comments
Comments
(0)