In my stream I have 1 pending message:
redis[7]> XREADGROUP GROUP symfony consumer COUNT 1 STREAMS messages 0
1) 1) "messages"
2) 1) 1) "1592850947048-0"
2) (nil)
redis[7]> XPENDING messages symfony
1) (integer) 1
2) "1592850947048-0"
3) "1592850947048-0"
4) 1) 1) "consumer"
2) "1"
It can’t be (nil), but still..
I read new message:
redis[7]> XREADGROUP GROUP symfony consumer COUNT 1 STREAMS messages >
1) 1) "messages"
2) 1) 1) "1593141769417-0"
2) 1) "message"
2) "s:726:"{"body":"O:36:\\\"Symfony\\\\Component\\\\Messenger\\\\Envelope\\\":2:{s:44:\\\"\\0Symfony\\\\Component\\\\Messenger\\\\Envelope\\0stamps\\\";a:1:{s:46:\\\"Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\BusNameStamp\\\";a:1:{i:0;O:46:\\\"Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\BusNameStamp\\\":1:{s:55:\\\"\\0Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\BusNameStamp\\0busName\\\";s:21:\\\"messenger.bus.default\\\";}}}s:45:\\\"\\0Symfony\\\\Component\\\\Messenger\\\\Envelope\\0message\\\";O:26:\\\"App\\\\Bus\\\\Message\\\":2:{s:32:\\\"\\0App\\\\Bus\\\\Message\\0type\\\";i:6;s:35:\\\"\\0App\\\\Bus\\\\Message\\0payload\\\";a:1:{s:7:\\\"eventId\\\";i:83787;}}}","headers":[]}";"
redis[7]> XPENDING messages symfony
1) (integer) 2
2) "1592850947048-0"
3) "1593141769417-0"
4) 1) 1) "consumer"
2) "2"
New message is not empty, but if I read messages – both are (nil)
redis[7]> XREADGROUP GROUP symfony consumer COUNT 2 STREAMS messages 0
1) 1) "messages"
2) 1) 1) "1592850947048-0"
2) (nil)
2) 1) "1593141769417-0"
2) (nil)
Why?
2
Answers
It's normal behaviour of redis stream? Redis delete old message body (set to
nil
) even if message received some consumer.This is actually a bug when use some version of redis 5.0.
And it is fixed in https://github.com/redis/redis/pull/6703.