Skip to content

[Messenger] Fanout message per handler to the transport #33328

Closed
@ruudk

Description

@ruudk

Given you have 4 handlers that are interested in SomethingHappenedEvent.
All 4 handlers use the async transport (e.g. RabbitMQ)
You have a retry strategy enabled.
The SomethingHappenedEvent is dispatched onto the event.bus
When a consumer consumes the message it will invoke all 4 handlers.
Handler number 3 throws an exception.
The message will be marked as failed and automatically retried some time later.
The same 4 handlers are invoked.
Handler 1, 2 and 4 already did the work but are invoked again.
Handler number 3 throws an exception.
Repeat...

I think the problem is that there is only 1 message published to the transport. In my opinion, there should be 4 messages published to the transport. For every handler one specific message. They can even be on separate queues.

At my company, we're using SimpleBus with RabbitMQ and we've had the same broken behavior in our production application. That lead to many weird situations where things were invoked multiple times. Then we found out that it was related to failure handling and retries. We fixed that by changing the producer's side. It now looks at all handlers that are interested and creates specific messages for each of them.

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