Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Messenger] WorkerMessageReceivedEvent::setEnvelope was never added #50799

Copy link
Copy link
Closed
@bosam

Description

@bosam
Issue body actions

Symfony version(s) affected

5.2 and above

Description

Hi,

I've been experiencing with Symfony/Messenger for a bit and I noticed that when subscribing to WorkerMessageReceivedEvent the envelope was not mutable due to the fact that the parent class does not support setEnvelope.

You can see the changelog here stating that this method was added here.

5.2.0
---
Added WorkerMessageReceivedEvent::setEnvelope() and made event mutable

When looking at the commit responsible for introducing this feature, you can see the work done on the worker to get the envelope back after the dispatch and the added addStamp method operating on the envelope itself but no code allowing for a redefinition of the aforementioned envelope.

I am betting on a mistake as we are indeed making the envelope mutable with addStamp and either the setter was planned and got removed but the changelog message was not changed?

How to reproduce

Install any version of symfony/Messenger after 5.2

$envelope = new \Symfony\Component\Messenger\Envelope::wrap(new \stdClass());
$event = new \Symfony\Component\Messenger\Event\WorkerMessageReceivedEvent($envelope, 'myReceiver');

$event->setEnvelope(); // This method does not exist

Possible Solution

Implement setEnvelope in either WorkerMessageReceivedEvent or the parent class.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.