diff --git a/src/Swisschain.Extensions.Idempotency/DefaultOutboxRepository.cs b/src/Swisschain.Extensions.Idempotency/DefaultOutboxRepository.cs index f60afb0..9eca79c 100644 --- a/src/Swisschain.Extensions.Idempotency/DefaultOutboxRepository.cs +++ b/src/Swisschain.Extensions.Idempotency/DefaultOutboxRepository.cs @@ -10,9 +10,14 @@ public Task Open(string requestId, Func> aggregateIdFactory) throw new InvalidOperationException("Outbox repository is not configured. To use outbox, you need to configure repository in service.AddOutbox(c => {...})"); } + public Task Open(string requestId) + { + throw new InvalidOperationException("Outbox repository is not configured. To use outbox, you need to configure repository in service.AddOutbox(c => {...})"); + } + public Task Save(Outbox outbox, OutboxPersistingReason reason) { throw new InvalidOperationException("Outbox repository is not configured. To use outbox, you need to configure repository in service.AddOutbox(c => {...})"); } } -} \ No newline at end of file +} diff --git a/src/Swisschain.Extensions.Idempotency/IOutboxManager.cs b/src/Swisschain.Extensions.Idempotency/IOutboxManager.cs index c770042..cb85484 100644 --- a/src/Swisschain.Extensions.Idempotency/IOutboxManager.cs +++ b/src/Swisschain.Extensions.Idempotency/IOutboxManager.cs @@ -6,6 +6,7 @@ namespace Swisschain.Extensions.Idempotency public interface IOutboxManager { Task Open(string requestId, Func> aggregateIdFactory); + Task Open(string requestId); Task Store(Outbox outbox); Task EnsureDispatched(Outbox outbox); Task EnsureDispatched(Outbox outbox, IOutboxDispatcher dispatcher); diff --git a/src/Swisschain.Extensions.Idempotency/IOutboxRepository.cs b/src/Swisschain.Extensions.Idempotency/IOutboxRepository.cs index 7028dfd..b39b8cf 100644 --- a/src/Swisschain.Extensions.Idempotency/IOutboxRepository.cs +++ b/src/Swisschain.Extensions.Idempotency/IOutboxRepository.cs @@ -6,6 +6,7 @@ namespace Swisschain.Extensions.Idempotency public interface IOutboxRepository { Task Open(string requestId, Func> aggregateIdFactory); + Task Open(string requestId); Task Save(Outbox outbox, OutboxPersistingReason reason); } } diff --git a/src/Swisschain.Extensions.Idempotency/Outbox.cs b/src/Swisschain.Extensions.Idempotency/Outbox.cs index 167ec9a..e3749c5 100644 --- a/src/Swisschain.Extensions.Idempotency/Outbox.cs +++ b/src/Swisschain.Extensions.Idempotency/Outbox.cs @@ -63,12 +63,12 @@ public void Publish(object evt) public static Outbox Restore(string requestId, long aggregateId, bool isStored, - bool isShipped, + bool isDispatched, object response, IEnumerable commands, IEnumerable events) { - var instance = new Outbox(requestId, aggregateId, isStored, isShipped) + var instance = new Outbox(requestId, aggregateId, isStored, isDispatched) { Response = response }; diff --git a/src/Swisschain.Extensions.Idempotency/OutboxManager.cs b/src/Swisschain.Extensions.Idempotency/OutboxManager.cs index a597b67..f29b14a 100644 --- a/src/Swisschain.Extensions.Idempotency/OutboxManager.cs +++ b/src/Swisschain.Extensions.Idempotency/OutboxManager.cs @@ -15,9 +15,14 @@ public OutboxManager(IOutboxDispatcher dispatcher, _repository = repository; } - public async Task Open(string requestId, Func> aggregateIdFactory) + public Task Open(string requestId, Func> aggregateIdFactory) { - return await _repository.Open(requestId, aggregateIdFactory); + return _repository.Open(requestId, aggregateIdFactory); + } + + public Task Open(string requestId) + { + return _repository.Open(requestId); } public async Task Store(Outbox outbox) diff --git a/src/Swisschain.Extensions.Idempotency/OutboxServiceCollectionExtensions.cs b/src/Swisschain.Extensions.Idempotency/OutboxServiceCollectionExtensions.cs index 681fef6..fc2a8c6 100644 --- a/src/Swisschain.Extensions.Idempotency/OutboxServiceCollectionExtensions.cs +++ b/src/Swisschain.Extensions.Idempotency/OutboxServiceCollectionExtensions.cs @@ -9,16 +9,15 @@ public static IServiceCollection AddOutbox(this IServiceCollection services, Act { services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + if (config != null) { var configBuilder = new OutboxConfigurationBuilder(services); config.Invoke(configBuilder); } - else - { - - } return services; }