Hi,
With redis 5.0.5, I can remove messages in a stream with XDEL and XTRIM.
In order to guarantee all / most messages are delivered and processed before removing, I use XACK + XDEL instead of XTRIM. And it costs 2 commands / round trips for each message.
Could you please provide another option in XACK command for removing specified message?
Thanks
Comment From: kristoff-it
You could use pipelining to only pay for 1 RTT. More importantly, you should be using a transaction to ensure that both XACK and XDEL happen atomically and get persisted in a all-or-nothing fashion. Most client libraries will automatically perform pipelining for you when doing a transaction.
But, more importantly than anything I just wrote, if you're using consumer groups AND are deleting each message upon completion, you might want to use Lists instead of Streams.
Comment From: hoangdt84
Thanks @kristoff-it,
You're right about pipelining but still, we need 2 commands :). For transaction, I don't think we need it in our use case.
We implement "at least 1" pattern for delivery & process. We did try with list (BLPOPand BRPOPLPUSH) but performance was not good, especially when we had a lot of messages or payloads were too big. We also tried to saved key in a list and payload as an item, but it made things more complex (even more with cluster and transaction)
Comment From: leomurillo
I think it makes sense having to issue the two commands, as there may be other consumer groups or even other processes reading without using consumer groups.
All consumer-group related commands leave the stream as is, it is a separate entity. Adding this feature would break that.
On the other hand, if we had a XACK with delete option, why not an XREAD with delete option as well? Or an XREADGROUP NOACK with del option?
Having to issue a second command for delete is not a big deal when we have pipelining, transactions and LUA scripts.