enerBit / redsumer-rs

MIT License
1 stars 1 forks source link

v0.4.0 #11

Closed JMTamayo closed 4 months ago

JMTamayo commented 4 months ago

Important comments for reviewing the PR:

  1. The project was refactored as a WORKSPACE. Therefore, most of the changes correspond to changes in the location of the modules within the new folder structure. This change seeks to prepare the project for the future in case you want to extend the project, for example, writing the core in Rust and implementing it in other languages such as python.
  2. A new message consumption methodology was implemented based on https://github.com/elpablete/refactored-computing-machine.
  3. This PR does not correspond to a version to be published because the implementation of an examples module and improvements to the documentation are still in process.

Thanks for your review 👍

JMTamayo commented 4 months ago

Why not use xautoclaim, and instead do the double round trip to the server with xpending and xclaim with the extra "is mine" check? Particularly because the check for ownership in the server should be done as near as possible to the moment of actual processing.

XAUTOCLAIM is not implemented in redis v0.25.3, so, I implemented XPENDING and XCLAIM to claim pending messages from another consumers according to the consumer configuration.

https://docs.rs/redis/latest/redis/

JMTamayo commented 4 months ago

Why not use xautoclaim, and instead do the double round trip to the server with xpending and xclaim with the extra "is mine" check? Particularly because the check for ownership in the server should be done as near as possible to the moment of actual processing.

The claim_pending_messages function was modified to implement the combination of XPENDING + XCLAIM without the "it is not mine" validation that previously existed. The objective is to minimize the time between the XPENDING response and the request with XCLAIM as much as possible.

Currently, XAUTOCLAIM is not supported by redis-rs, however, I will manage its implementation with the project contributors. When this development is ready, we proceed to implement it in redsumer.

Please take a look at last changes in this PR. Thanks.