8000 Scheduler is unable to redispatch message when serializing messages using json · Issue #59190 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Scheduler is unable to redispatch message when serializing messages using json #59190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JoshuaEstes opened this issue Dec 12, 2024 · 3 comments

Comments

@JoshuaEstes
Copy link

Symfony version(s) affected

7.2.0

Description

Error Message:

[Symfony\Component\Messenger\Exception\MessageDecodingFailedException]
  Could not decode stamp: The type of the "trigger" attribute for class "Symfony\Component\Scheduler\Generator\MessageContext" must be one of "Symfony\Component\Sc
  heduler\Trigger\TriggerInterface" ("array" given).

How to reproduce

# config/messenger.yaml
framework:
  messenger:
    serializer:
      default_serializer: messenger.transport.symfony_serializer
      symfony_serializer:
        format: json
        context: { }
// src/Scheduler/DefaultScheduleProvider.php
// ...
use Symfony\Component\Messenger\Message\RedispatchMessage;
// ...
      RecurringMessage::every('1 minute', new RedispatchMessage(new MyMessageThatNeedsToBeRedispatched(), 'low')),
// ...

Run messenger:consume using the scheduler and the transport. The scheduler will redispatch the message and when symfony tries to unserialize the message it will fail

Possible Solution

May a custom normalizer would solve the issue? I think it's something to do with Symfony\Component\Scheduler\Generator\MessageContext but not too sure.

Additional Context

You can comment out the serializer section in the yaml context and everything works as expected. It will produce messages and consume messages just fine when that happens, but it is not in json format.

@xabbuh
Copy link
Member
xabbuh commented Dec 12, 2024

Can you create a small example application that allows to reproduce your issue?

@valtzu
Copy link
Contributor
valtzu commented Dec 13, 2024

Duplicate of #53562

@JoshuaEstes
Copy link
Author

Sure is, not sure why I was never able to find that issue. Thank you for pointing this out. I'm closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0