Skip to content

[Messenger] sync transport does not trigger handled/received/retried/failed events #57623

Open
@cpernot-hf

Description

@cpernot-hf

Symfony version(s) affected

5.4

Description

Hi,

in dev environment (symfony 5.4), while trying to handle our messages synchronously (mainly to avoid starting 20 workers and use CPU/memory for nothing), we use this kind of configuration :

    messenger:
        transports:
            messenger_export: 'sync://'

The messages are well treated synchronously, but we don't get the events WorkerMessageReceivedEvent/WorkerMessageRetriedEvent/WorkerMessageHandledEvent/WorkerMessageFailedEvent to be triggered.

It may seem logical, as there is no worker, but we have some business logic attached to those events (ex: notify the user that the export is done).

I think it should work regardless of the transport.
Are there other events to handle this kind of thing ?

Maybe I missed some documentation :)

How to reproduce

Configure one sync transport

    messenger:
        transports:
            messenger_export: 'sync://'

Create a Subscriber attached to WorkerMessageReceivedEvent, WorkerMessageRetriedEvent, WorkerMessageHandledEvent and/or WorkerMessageFailedEvent, and see its code is never run.

Possible Solution

No response

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