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.
2
Answers
You can use
xpending
command: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:
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.