Skip to content

[Messenger] doesn't recognize issues in handler when it's a generator #53887

Open
@dkarlovi

Description

@dkarlovi

Symfony version(s) affected

6.4.0

Description

When the handler is a generator (which you might want if using it sync, and shouldn't be an issue when using async, the values just get ignored), Messenger doesn't recognize failures to execute the handler.

How to reproduce

Do this

#[AsHandler]
class MessageHandler {
     function __invoke(Message $message): iterable
    {
        dd($message);
        yield $message;
    }
}

From my experimentations, this works as expected when using sync transport, but fails with async (in my case Redis), it doesn't recognize the handler having failed.

Possible Solution

Check for the handler being a generator?

Additional Context

No response

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