public async Task Complete <TMessage>(Func <TMessage, IMessageHandlerContext, Task> sagaStepHandler, ISagaMessage message, IMessageBrokerContext context) where TMessage : IMessage { SagaContext saga = await _sagaInitializer.Initialize(message, context).ConfigureAwait(false); if (!(sagaStepHandler is null)) { await sagaStepHandler((TMessage)message, context).ConfigureAwait(false); } if (context.Container.TryGet <ErrorContext>(out var errorContext)) { saga.Fail(errorContext.ToString()); } else if (context.Container.TryGet <CompensationRoutingContext>(out var compensateContext)) { saga.Fail(compensateContext.ToString()); } else { saga.Success(); } context.BrokeredMessage.WithSagaStatus(saga.Status.Status); await _sagaPersister.Persist(saga, message, context).ConfigureAwait(false); }
public async Task Persist(SagaDataContainer sagaContainer) { await impl.Persist(sagaContainer).ConfigureAwait(false); await barrier("Saga.Persist").ConfigureAwait(false); }
public async Task Persist(SagaDataContainer sagaContainer) { await Barrier().ConfigureAwait(false); await realPersister.Persist(sagaContainer).ConfigureAwait(false); }