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
Description
When creating a handler that implements MessageSubscriberInterface, which passes custom options about the handler (e.g. from_transport from #30958), if the user changes those options, they are not visible in the app. The problem is that this input is used to create an internal service (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php#L168), but the files these options were sourced from (the handler itself) is not added as a container resource.
Completely clear the cache. You can see that this handler is only called when coming from some async transport. Now, change to some other transport name and try again. It will still try to consume only from the original, async transport.
Possible Solution
If the config comes from the handler (i.e. if it implements MessageSubscriberInterface), it should be added as a resource. Doesn't this also affect normal MessageHandlerInterface handlers - if you changed the type-hint to __invoke(), would that cause a container rebuild?
The text was updated successfully, but these errors were encountered:
…bscribers change (weaverryan)
This PR was merged into the 4.2 branch.
Discussion
----------
[Messenger] Making cache rebuild correctly when message subscribers change
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #31409
| License | MIT
| Doc PR | not needed
An edge-case that's identical to `EventSubscriberInterface`: when the return value of `getHandledMessages()` changes, the container needs to be rebuilt.
If you're wondering why these checks aren't in their own resource class, see #25984 - it's something we probably should do, but haven't done yet.
Commits
-------
d88446b Making cache rebuild correctly with MessageSubscriberInterface return values
Symfony version(s) affected: master (4.3)
Description
When creating a handler that implements
MessageSubscriberInterface
, which passes custom options about the handler (e.g.from_transport
from #30958), if the user changes those options, they are not visible in the app. The problem is that this input is used to create an internal service (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php#L168), but the files these options were sourced from (the handler itself) is not added as a container resource.How to reproduce
Completely clear the cache. You can see that this handler is only called when coming from some
async
transport. Now, change to some other transport name and try again. It will still try to consume only from the original,async
transport.Possible Solution
If the config comes from the handler (i.e. if it implements
MessageSubscriberInterface
), it should be added as a resource. Doesn't this also affect normalMessageHandlerInterface
handlers - if you changed the type-hint to__invoke()
, would that cause a container rebuild?The text was updated successfully, but these errors were encountered: