8000 [Messenger] `WorkerMessageRetriedEvent` filled with not actual `Envelope` · Issue #52914 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Messenger] WorkerMessageRetriedEvent filled with not actual Envelope #52914
Closed
@daffoxdev

Description

@daffoxdev

Description

Hi!

In Symfony\Component\Messenger\EventListener\SendFailedMessageForRetryListener exists following lines:

// re-send the message for retry
$this->getSenderForTransport($event->getReceiverName())->send($retryEnvelope);

$this->eventDispatcher?->dispatch(new WorkerMessageRetriedEvent($retryEnvelope, $event->getReceiverName()));

Why it's not passing newly created envelope in transport with new stamps to the event WorkerMessageRetriedEvent?
I mean:

// re-send the message for retry
$newEnvelope = $this->getSenderForTransport($event->getReceiverName())->send($retryEnvelope);

$this->eventDispatcher?->dispatch(new WorkerMessageRetriedEvent($newEnvelope, $event->getReceiverName()));

This leads to issue that this WorkerMessageRetriedEvent not know any data about inserted row to DB as $retryEnvelope is outdated after send() call. I need to get TransportMessageIdStamp by Doctrine for new inserted id, it stores in Envelope that returns by send, but current version not passing it further. It's impossible to do it in clear way here. Also if I have custom transport that adds some custom stamps that expected to be handled in this WorkerMessageRetriedEvent, it's is not possible currently.

Do you have any suggestions? And is current implementation 100% correct and it's not planning to change this place?

Example

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

      0