When any new message received in the stream, on that time OnMessageReceived event should trigger.
public event EventHandler<MqMessageReceivedEventArgs> OnMessageReceived;
var result = await redisDatabase.StreamRangeAsync(StreamName, "-", "+", 1, Order.Ascending);
protected virtual void OnMessageReceivedEvent(MqMessageReceivedEventArgs e)
{
OnMessageReceived?.Invoke(this, e);
}
2
Answers
According to official documentation, you have to do the following:
Define pasing function:
Start consumer task:
looks like you are trying to call/trigger OnMessageReceivedEvent, when this called a event with new msg will receive in stream. asuming logic already implemented and it listen for msg in stream.