Skip to content

Commit

Permalink
IsStored and IsDispatched flags fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinRyazantsev committed Apr 12, 2020
1 parent 96aaeb4 commit d8b70e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Swisschain.Extensions.Idempotency/Outbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ private Outbox(string requestId, long aggregateId, bool isStored, bool isDispatc

public string RequestId { get; }
public long AggregateId { get; }
public bool IsStored { get; }
public bool IsDispatched { get; }
public bool IsStored { get; internal set; }
public bool IsDispatched { get; internal set; }
public object Response { get; private set; }
public IReadOnlyCollection<object> Commands => new ReadOnlyCollection<object>(_commands);
public IReadOnlyCollection<object> Events => new ReadOnlyCollection<object>(_events);
Expand Down
6 changes: 6 additions & 0 deletions src/Swisschain.Extensions.Idempotency/OutboxManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public Task<Outbox> Open(string requestId)
public async Task Store(Outbox outbox)
{
await _repository.Save(outbox, OutboxPersistingReason.Storing);

outbox.IsStored = true;
}

public async Task EnsureDispatched(Outbox outbox)
Expand All @@ -48,6 +50,8 @@ public async Task EnsureDispatched(Outbox outbox)
}

await _repository.Save(outbox, OutboxPersistingReason.Dispatching);

outbox.IsDispatched = true;
}

public async Task EnsureDispatched(Outbox outbox, IOutboxDispatcher dispatcher)
Expand All @@ -68,6 +72,8 @@ public async Task EnsureDispatched(Outbox outbox, IOutboxDispatcher dispatcher)
}

await _repository.Save(outbox, OutboxPersistingReason.Dispatching);

outbox.IsDispatched = true;
}
}
}

0 comments on commit d8b70e7

Please sign in to comment.