Esempio n. 1
0
        public async Task ProcessAsync <TMessage>(ISaga saga, TMessage message, ISagaState state,
                                                  ISagaContext context) where TMessage : class
        {
            var action = (ISagaAction <TMessage>)saga;

            try
            {
                await action.HandleAsync(message, context);
            }
            catch (Exception e)
            {
                context.SagaContextError = new SagaContextError(e);

                if (!(saga.State is SagaStates.Rejected))
                {
                    saga.Reject();
                }
            }
            finally
            {
                await UpdateSagaAsync(message, saga, state);
            }
        }