StreamReadGroupAsync
This commit is contained in:
parent
96d16d22ec
commit
f3b395ce01
|
|
@ -1,5 +1,4 @@
|
|||
using StackExchange.Redis;
|
||||
using System.Threading.Channels;
|
||||
|
||||
namespace BotSharp.Core.Infrastructures.Events;
|
||||
|
||||
|
|
@ -51,7 +50,6 @@ public class RedisSubscriber : IEventSubscriber
|
|||
foreach (var entry in entries)
|
||||
{
|
||||
_logger.LogInformation($"Consumer {Environment.MachineName} received: {channel} {entry.Values[0].Value}");
|
||||
await db.StreamAcknowledgeAsync(channel, group, entry.Id);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -64,6 +62,10 @@ public class RedisSubscriber : IEventSubscriber
|
|||
{
|
||||
_logger.LogError($"Error processing message: {ex.Message}, event id: {channel} {entry.Id}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
await db.StreamAcknowledgeAsync(channel, group, entry.Id);
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Delay(Random.Shared.Next(1, 11) * 100);
|
||||
|
|
|
|||
Loading…
Reference in a new issue