Reventuous / reventuous

Event Sourcing library for C# using Redis Streams as event store
MIT License
0 stars 0 forks source link

$all stream #1

Open alexeyzimarev opened 1 year ago

alexeyzimarev commented 1 year ago

Hey, nice to see some ideas!

I see that you made a trick to create links in $all and category/event type. How does it work for you? Is it transactional?

Have you been able to test it for performance and reliability? If it works, I'd be happy to include it to the original project.

claudiuchis commented 1 year ago

Hey Alexey,

Redis Gears scripts run in a separate thread, so these links would be created asynchronously which is not what we want, as the order of events would not be ensured to be correct in these streams. https://redis.com/blog/introduction-to-redisgears/#:~:text=Gears%20is%20asynchronous&text=RedisGears%20scripts%20run%20in%20a,embedded%20inside%20a%20Redis%20transaction.

I haven't played with Lua scripts yet which Redis say can include custom transactional logic. That's next on my list.

claudiuchis commented 1 year ago

It seems that Redis functions (which is a new concept introduced in Redis 7) allows us extend the standard Redis commands. So, I can create a new command (let's call it XXADD) in a new module that can use the original XADD command to update multiple Redis streams in one atomic transaction, thus allowing us to maintain the $all stream (and any other streams like this) in a safe way. Once the new module is loaded into Redis, the new command can be used like any other Redis commands, so I hope the StackExchange.Redis .net client will have no issue with it. I'll work on a version of an event store for Redis based on this idea and the new eventous code base (Reventuous is based on the old one), and submit a PR in the next few days.