Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Scheduler] RedispatchMessage and custom Scheduler triggers - message cannot be dispatched if Trigger is not serializable #59719

Open
@petrisorciprian-vitals

Description

@petrisorciprian-vitals

Symfony version(s) affected

6.4, 7.2

Description

In#51092 theScheduledStamp was made Sendable, so that it is now passed along with theRedispatchMessage to the target transport.

This is okay, however it seems it implies anycustom trigger needs to be serializable, otherwise dispatching it to the transport fails.

For now, I have worked around this by replacing the trigger in the ScheduledStamp with a 'dummy' one that is serializable using an event listener onSendMessageToTransportsEvent event, however I was wondering if Custom Triggers should be completely incompatible withRedispatchMessage?

How to reproduce

  1. Create a custom trigger with a non-serializable field (e.g. an empty \Closure or a Service class)
  2. Configure a RecurringMessage with said trigger, wrapped in aRedispatchMessage:
return (newSchedule())            ->add(                RecurringMessage::trigger(newUnserializableTrigger(function () => {}),newRedispatchMessage(newMyMessage(),'myTransport')                )            );
  1. Runbin/console messenger:consume scheduler_<name>
  2. Results in an error such as:
Error thrown while handling message Symfony\Component\Messenger\Message\RedispatchMessage. Removing from transport after 0 retries. Error: "Handling "Symfony\Component\Messenger\Message\RedispatchMessage" failed: Cannot serialize <blabla>" ["class" => "Symfony\Component\Messenger\Message\RedispatchMessage","retryCount" => 0,"error" => "Handling "Symfony\Component\Messenger\Message\RedispatchMessage" failed: Cannot serialize <blabla>","exception" => Symfony\Component\Messenger\Exception\HandlerFailedException^ { …}]

Possible Solution

One obvious option is to not serialize thetrigger object into the ScheduledStamp (not entirely sure how/if the trigger itself is used on the transport side?)

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp