예제 #1
0
        public async Task <SagaConsumeContext <TSaga, TMessage> > Add(TSaga instance)
        {
            if (_sagasLocked)
            {
                var consumeContext = await _factory.CreateSagaConsumeContext(_sagas, _context, instance, SagaConsumeContextMode.Add).ConfigureAwait(false);

                _sagas.Release();
                _sagasLocked = false;

                return(consumeContext);
            }

            await _sagas.MarkInUse(_context.CancellationToken).ConfigureAwait(false);

            try
            {
                return(await _factory.CreateSagaConsumeContext(_sagas, _context, instance, SagaConsumeContextMode.Add).ConfigureAwait(false));
            }
            finally
            {
                _sagas.Release();
            }
        }
예제 #2
0
 public Task <SagaConsumeContext <TSaga, T> > CreateSagaConsumeContext <T>(ConsumeContext <T> consumeContext, TSaga instance, SagaConsumeContextMode mode)
     where T : class
 {
     return(_factory.CreateSagaConsumeContext(_context, consumeContext, instance, mode));
 }
 public Task <SagaConsumeContext <TSaga, TMessage> > Add(TSaga instance)
 {
     return(_factory.CreateSagaConsumeContext(_dbContext, _consumeContext, instance, SagaConsumeContextMode.Add));
 }