Looking at Redis streams and building indexes on a stream ( like EventStore does) , this works pretty well and i can get a bunch of entries in a stream except i cant find a nice way to return all the records by id eg like an MGET. This is a simplified version of what im looking at.
var records = await conn.StreamRangeAsync(indexStreamName, nextPosition, null, BatchSize);
if (records.Any())
{
var results = new List<Event>();
foreach (var record in records)
{
var msgs = await conn.StreamRangeAsync(record.Values.FirstOrDefault(x => x.Name == "stream").Value.ToString(), record.Values.FirstOrDefault(x => x.Name == "key").Value, null, 1);
results.Add(ToEvent(msgs.First()));
}
await playEvents(results.ToArray());
}
Obviously this is very inefficient and i was wondering is there some way to get this from the server in 1 request.
I also considered streams building other streams however it will result in message duplication and our messages can get large. Yes i could than put all messages in a set but 2 levels of indirection is a bridge too far.