skip to Main Content

Can they be reassigned, put back onto the queue?

What good way is there to ensure nothing pending is there for too long?

2

Answers


  1. You can use xpending command:

    XPENDING mystream group55 - + 10 consumer-123
    
    Login or Signup to reply.
  2. What happens with the pending messages when the consumer is deleted?

    According to XGROUP DELCONSUMER, all pending messages will be deleted.
    You can easily verify it by yourself:

    // Create stream and fill it with some messages
    XADD mystream * msg 1
    XADD mystream * msg 2
    XADD mystream * msg 3
    
    // Create group for stream and set read position to start
    XGROUP CREATE mystream mygroup 0
    
    // Read 2 messages
    XREADGROUP GROUP mygroup myconsumer COUNT 2 STREAMS mystream >
    
    // Verify that messages we read are pending
    XPENDING mystream mygroup - + 10 myconsumer
    
    // Delete Consumer
    XGROUP DELCONSUMER mystream mygroup myconsumer
    
    // Verify that pending messages are gone
    XPENDING mystream mygroup - + 10 myconsumer
    
    // Verify that new consumer receives third message only
    XREADGROUP GROUP mygroup mynewconsumer STREAMS mystream >
    

    AFAIK there is no explicit way to put pending messages back to stream, but you can reassign them with XCLAIM and XAUTOCLAIM to another consumer and then safely delete consumer.

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