8000 [Messenger] `AsMessageHandler` attribute on methods do not work anymore · Issue #50202 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Messenger] AsMessageHandler attribute on methods do not work anymore #50202

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

Closed
Korbeil opened this issue May 2, 2023 · 1 comment
Closed

Comments

@Korbeil
Copy link
Contributor
Korbeil commented May 2, 2023

Symfony version(s) affected

6.3.0-BETA1

Description

Hey 👋

My friend @welcoMattic told me Symfony 6.3.0-BETA1 got out and I had to test if there is some regression issues and found one with Messenger component.

When you make a Handler, if you do:

#[AsMessageHandler]
class MessageHandler
{
    public function __invoke(SimpleMessage $message): void
    {
        // do stuff
    }
}

You can use it freely and it will work like a charm.

But if you do:

class MessageHandler
{
    #[AsMessageHandler]
    public function batch(BatchMessage $batchMessage): void
    {
        // batch
    }

    #[AsMessageHandler]
    public function simple(SimpleMessage $message): void
    {
        // simple
    }
}

During cache warmup you will have the following error:
image

How to reproduce

See https://github.com/Korbeil/reproducer-63-messenger-handler/ for a simple reproducer.
And more specifically https://github.com/Korbeil/reproducer-63-messenger-handler/blob/main/src/Messenger/MessageHandler.php since it's where the issue is.

Possible Solution

No response

Additional Context

No response

@nicolas-grekas
Copy link
Member

Thanks for the reproducer.

nicolas-grekas added a commit that referenced this issue May 2, 2023
This PR was merged into the 5.4 branch.

Discussion
----------

[Messenger] Fix registering message handlers

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #50202
| License       | MIT
| Doc PR        | -

Commits
-------

dfd7a5b [Messenger] Fix registering message handlers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0