I need to read from a REDIS stream while the server will still be writing to the STream. Now there are 2 ways. 1 way is to get a list of messages already there. I am doing it as indicated below. However i want to do a blocking read so that my client console app will wait for the messages in the stream. I know the same can be done using following command in REDIS-CLI. I want to achieve the same result in C# XREAD BLOCK 1000 STREAMS #channel1 1526999626221-0
IDatabase db = redis.GetDatabase();
while (true)
{
iteration++;
//var messages = db.StreamRead("#channel1", "0-0");
var messages = db.StreamRead("#channel1", lastMessageInAsequence);
IEnumerator MessageEnumerator = messages.GetEnumerator();
while (MessageEnumerator.MoveNext())
{
StackExchange.Redis.NameValueEntry[] entry1 = ((StackExchange.Redis.StreamEntry)MessageEnumerator.Current).Values;
lineCount++;
Console.WriteLine(entry1[0].Name + ":" + entry1[0].Value);
lastMessageInAsequence = entry1[0].Name;
}
Console.WriteLine($"{lineCount} lines read from stream in 1 go in iteration {iteration}");
}