some changes

This commit is contained in:
john 2025-05-17 23:47:19 +02:00
parent 4ec9720541
commit b47bac67ca
37 changed files with 397 additions and 190 deletions

View file

@ -3,7 +3,7 @@ namespace Femto.Common.Infrastructure.Outbox;
public class OutboxEntry
{
private const int MaxRetries = 5;
public Guid Id { get; private set; }
public string EventType { get; private set; } = null!;
@ -18,7 +18,7 @@ public class OutboxEntry
public int RetryCount { get; private set; } = 0;
public string? LastError { get; private set; }
public OutboxEntryStatus Status { get; private set; }
private OutboxEntry() { }
public OutboxEntry(Guid eventId, Guid aggregateId, string eventType, string payload)
@ -35,7 +35,7 @@ public class OutboxEntry
this.ProcessedAt = DateTime.UtcNow;
this.Status = OutboxEntryStatus.Completed;
}
public void Fail(string error)
{
if (this.RetryCount >= MaxRetries)
@ -53,7 +53,7 @@ public class OutboxEntry
public enum OutboxEntryStatus
{
Pending,
Completed,
Failed
}
Pending = 0,
Completed = 1,
Failed = 2,
}