Skip to content

[Messenger] Passing stamps to message Handler #31075

Closed
@enumag

Description

@enumag

Description

When working with symfony/messenger I sometimes find myself implementing a message handler where I would need some of the stamps that are attached to the message. Currently the HandleMiddleware only passes the message itself but there is no way for the handler to get the stamps. This is forcing me to rewrite such handlers to middlewares.

Example

I'm trying to use Messenger for CQRS + Event Sourcing. So I add stamps like event id, aggregate type, some data about the user who initiated the action etc. In some cases the CommandBus or EventBus handlers need the data about the user or aggregate.

Solution

In my opinion the handler should receive an array of stamps or possibly better the Envelope class as second argument. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions