Closed
Description
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.