Exemple #1
0
        public TSaga Create(ConsumeContext <TMessage> context)
        {
            if (!context.CorrelationId.HasValue)
            {
                throw new SagaException("The correlationId was not present and the saga could not be created", typeof(TSaga), typeof(TMessage));
            }

            return(SagaMetadataCache <TSaga> .FactoryMethod(context.CorrelationId.Value));
        }
Exemple #2
0
        public Task Send(ConsumeContext <TMessage> context, IPipe <SagaConsumeContext <TSaga, TMessage> > next)
        {
            if (!context.CorrelationId.HasValue)
            {
                throw new SagaException("The correlationId was not present and the saga could not be created", typeof(TSaga), typeof(TMessage));
            }

            TSaga instance = SagaMetadataCache <TSaga> .FactoryMethod(context.CorrelationId.Value);

            var proxy = new NewSagaConsumeContext <TSaga, TMessage>(context, instance);

            proxy.LogCreated();

            return(next.Send(proxy));
        }
        public Task Send(ConsumeContext <TMessage> context, IPipe <SagaConsumeContext <TSaga, TMessage> > next)
        {
            if (!context.CorrelationId.HasValue)
            {
                throw new SagaException("The correlationId was not present and the saga could not be created", typeof(TSaga), typeof(TMessage));
            }

            TSaga instance = SagaMetadataCache <TSaga> .FactoryMethod(context.CorrelationId.Value);

            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("SAGA:{0}:{1} Created {2}", TypeMetadataCache <TSaga> .ShortName, instance.CorrelationId, TypeMetadataCache <TMessage> .ShortName);
            }

            var proxy = new NewSagaConsumeContext <TSaga, TMessage>(context, instance);

            return(next.Send(proxy));
        }
Exemple #4
0
        static Expression <Func <TSaga, TMessage, bool> > GetFilterExpression()
        {
            var instance = SagaMetadataCache <TSaga> .FactoryMethod(NewId.NextGuid());

            return(instance.CorrelationExpression);
        }