Description
I try to consume messages from a Redis Stream which are published by a third party, but messages do not follow the expected structure from the Redis Bridge.
However, my messages doesn't look like this, but more like:
{
"field1": "value1",
"field2": "value2"
}
How to reproduce
Use Redis Insight to push a message like
{
"field1": "value1",
"field2": "value2"
}
into a Stream, then consume this stream with symfony/redis-messenger.
Catch this error:
messenger:consume [-l|--limit LIMIT] [-f|--failure-limit FAILURE-LIMIT] [-m|--memory-limit MEMORY-LIMIT] [-t|--time-limit TIME-LIMIT] [--sleep SLEEP] [-b|--bus BUS] [--] [<receivers>...]
[OK] Consuming messages from transports "catalog_import".
// The worker will automatically exit once it has exceeded 128M of memory or
// received a stop signal via the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
// Re-run the command with a -vv option to see logs about consumed messages.
In Connection.php line 399:
Notice: Undefined index: message
messenger:consume [-l|--limit LIMIT] [-f|--failure-limit FAILURE-LIMIT] [-m|--memory-limit MEMORY-LIMIT] [-t|--time-limit TIME-LIMIT] [--sleep SLEEP] [-b|--bus BUS] [--] [<receivers>...]
Possible Solution
A possible solution could be to determine the existence of the key message in $message array, and if not exists, return the raw message, which could be decoded by a custom serializer.
Symfony version(s) affected: 5.2
Description
I try to consume messages from a Redis Stream which are published by a third party, but messages do not follow the expected structure from the Redis Bridge.
Accordingly to the code https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php#L398-L408
Messages have to be structured like:
However, my messages doesn't look like this, but more like:
How to reproduce
Use Redis Insight to push a message like
into a Stream, then consume this stream with symfony/redis-messenger.
Catch this error:
Possible Solution
A possible solution could be to determine the existence of the key
message
in$message
array, and if not exists, return the raw message, which could be decoded by a custom serializer.cc @lyrixx @sroze
The text was updated successfully, but these errors were encountered: