StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.9k stars 1.51k forks source link

Streams implementation with Rx #1475

Open aboimpinto opened 4 years ago

aboimpinto commented 4 years ago

Hello, I'm trying to find a way to not use the loop to get the data from the stream and bring it to my app using reactive extensions.

I open a StackOverflow thread where I'm putting all the possible solutions

The examples are very simple but not aligned with reality. Can we find a solution?

https://stackoverflow.com/questions/62012495/how-to-implement-redis-streams-with-c-sharp-rx

Paulo Aboim Pinto

mgravell commented 4 years ago

the "fix" here is probably to use blocking waits, but: that is blocked behind some work we need to do to enable blocking waits; with blocking, you aren't depoendent on the pub/sub, and you don't have the latency of poll

aboimpinto commented 4 years ago

the "fix" here is probably to use blocking waits, but: that is blocked behind some work we need to do to enable blocking waits; with blocking, you aren't depoendent on the pub/sub, and you don't have the latency of poll

that is true ... but I don't think that block will solve everything because we still need to keep a loop and refresh the block after a timeout or after getting something from the stream. I think with the "block" feature we could have a less footprint in terms of memory and CPU usage, but the problem would be the same.

do you have a solution, how this could be implemented with the current code base?

Paulo Aboim Pinto

mgravell commented 4 years ago

Ok, so that we're on the "same page" - exactly what problem would be the same? Imagine we had blocking stream reads: what is the issue you're still trying to solve?

aboimpinto commented 4 years ago

according to the current implementation of Block, we can block for X seconds or until receives the a message in the stream ... right? After we need to refresh the block ... and make sense to have it inside a loop.

Am I seeing this wrong?