Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger] Input for HandlerDescriptor should cause container rebuild #31409

Closed
@weaverryan

Description

@weaverryan

Symfony version(s) affected: master (4.3)

Description
When creating a handler that implementsMessageSubscriberInterface, 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

namespaceApp\MessageHandler;useApp\Message\SendEmail;useSymfony\Component\Messenger\Handler\MessageSubscriberInterface;class SendEmailHandlerimplements MessageSubscriberInterface{publicfunction__invoke(SendEmail$email)    {//    }publicstaticfunctiongetHandledMessages():iterable    {yield SendEmail::class => ['from_transport' =>'async',        ];    }}

Completely clear the cache. You can see that this handler is only called when coming from someasync transport. Now, change to some other transport name and try again. It willstill try to consume only from the original,async transport.

Possible Solution
If the config comes from the handler (i.e. if it implementsMessageSubscriberInterface), 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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp