skip to Main Content

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


  1. Chosen as BEST ANSWER
    127.0.0.1:6379[7]> XADD test-1 MAXLEN 3 * test-field-1 test-message-1
    "1593427016468-0"
    127.0.0.1:6379[7]> XADD test-1 MAXLEN 3 * test-field-2 test-message-2
    "1593427036073-0"
    127.0.0.1:6379[7]> XADD test-1 MAXLEN 3 * test-field-3 test-message-3
    "1593427043133-0"
    127.0.0.1:6379[7]> XGROUP CREATE test-1 test-group 0
    OK
    127.0.0.1:6379[7]> XREADGROUP GROUP test-group consumer COUNT 1 STREAMS test-1 >
    1) 1) "test-1"
       2) 1) 1) "1593427016468-0"
             2) 1) "test-field-1"
                2) "test-message-1"
    127.0.0.1:6379[7]> XADD test-1 MAXLEN 3 * test-field-4 test-message-4
    "1593427272729-0"
    127.0.0.1:6379[7]> XREADGROUP GROUP test-group consumer COUNT 1 STREAMS test-1 0
    1) 1) "test-1"
       2) 1) 1) "1593427016468-0"
             2) (nil)
    

    It's normal behaviour of redis stream? Redis delete old message body (set to nil) even if message received some consumer.


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search