StreamReadGroup Issue getting back zero records
I have ported the Ruby Sample of the streams to c#. It seems that I get back zero records when I ask for 1st record on the consumer.
string currentID = "0-0"; StreamEntry[] records = redisDB.StreamReadGroup( streamName, streamName+"Group", streamName+"GroupConsumer", currentID,1);
The stream has thousands of messages. The alternate API without groups works fine redisDB.StreamRead(streamName, currentID, 1);
There was a change in Redis version 5.0.2 or 5.0.3 in regards to how XREADGROUP works.
If a consumer has not read any messages yet, you have to pass the "messages never delivered to other consumers so far" special character (">") to XREADGROUP to read messages into an empty consumer. When passing an ID to XREADGROUP, the command will only return messages that have already been read by the consumer.
Take a look at the flow of commands in the screenshot below. I create the consumer group and configure it to read from the beginning of the stream (i.e., "0-0"). Then I issue a command to XREADGROUP to read from the beginning of the stream by passing the ID "0-0", but no messages are returned.
To remedy this, you first have to send the ">" special character as shown in the subsequent command. Once the consumer has read messages, I can pass an ID and get messages that have already been read (but not yet acknowledged) by the consumer.

When translating this workflow to the StackExchange.Redis client, the code should look like this:
db.StreamAdd(streamName, "f1", "v1");
db.StreamAdd(streamName, "f2", "v2");
db.StreamCreateConsumerGroup(streamName, groupName, "0-0");
var messages = db.StreamReadGroup(streamName, groupName, consumerName, StreamPosition.NewMessages);
// Or pass the character itself instead of using the StreamPosition helper.
var messages = db.StreamReadGroup(streamName, groupName, consumerName, ">");
// Then you can use the ID to read messages read by the consumer already.
var alreadyRead = db.StreamReadGroup(streamName, groupName, consumerName, "0-0");
Got it to work, thx. The key to making it work is this: db.StreamCreateConsumerGroup(streamName, groupName, "0-0");
p.s. This forces my microservice to always start from Beginning of stream. If I wanted it to continue from where it left but Beginning if it has not been run before what should I do? I mean I could use the equivalent of XINFO GROUP or XINFO CONSUMERS to figure out if my consumer has consumed from the group before and start accordingly but is there a shortcut in the stackexchange to achieve this?