protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _bookingRequestSagaRepository = new InMemorySagaRepository<BookingRequestState>();
            _bookingRequestStateMachine = new BookingRequestStateMachine();

            configurator.StateMachineSaga(_bookingRequestStateMachine, _bookingRequestSagaRepository);
        }
Exemplo n.º 2
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _machine    = new TestStateMachine();
            _repository = new InMemorySagaRepository <Instance>();

            configurator.StateMachineSaga(_machine, _repository);
        }
 protected override void ConfigureInMemoryReceiveEndpoint(
     IInMemoryReceiveEndpointConfigurator configurator)
 {
     _Machine    = new ProcessStateMachine();
     _Repository = new InMemorySagaRepository <Process>();
     configurator.StateMachineSaga(_Machine, _Repository);
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var repository = new InMemorySagaRepository <AnalysisStateMachineInstance>();
            var machine    = new AnalysisStateMachine();

            var bus = Bus.Factory.CreateUsingRabbitMq(sbc =>
            {
                var host = sbc.Host(new Uri("rabbitmq://localhost"), h =>
                {
                    h.Username("guest");
                    h.Password("guest");
                });

                //sbc.ReceiveEndpoint(host, "analysis_state", e =>
                //{
                //    e.PrefetchCount = 8;
                //    e.StateMachineSaga(machine, repository);
                //}); ;
            });

            bus.Start();

            bus.Publish(new YourMessage {
                Text = "Hi"
            });

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();

            bus.Stop();
        }
Exemplo n.º 5
0
        public static async Task Main(string[] args)
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                                .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true)
                                .Build();

            var sagaStateMachine = new GuideStateMachine();
            var repository       = new InMemorySagaRepository <GuideSagaState>();

            var bus = Bus.Factory.CreateUsingRabbitMq(cfg =>
            {
                cfg.Durable        = true;
                cfg.PrefetchCount  = 1;
                cfg.PurgeOnStartup = true;
                cfg.Host(new Uri(configuration["Rabbitmq:Url"]), hst =>
                {
                    hst.Username(configuration["Rabbitmq:Username"]);
                    hst.Password(configuration["Rabbitmq:Password"]);
                });

                cfg.ReceiveEndpoint("saga.service", e =>
                {
                    e.StateMachineSaga(sagaStateMachine, repository);
                });
            });
            await bus.StartAsync(CancellationToken.None);

            Console.WriteLine("Saga active.. Press enter to exit");
            Console.ReadLine();
            await bus.StopAsync(CancellationToken.None);
        }
Exemplo n.º 6
0
        private static void StartSubscriptionService()
        {
            Console.Out.WriteLine("starting the subscription service");

            var subscriptionSagaRepository = new InMemorySagaRepository<SubscriptionSaga>();
            var clientSagaRepository = new InMemorySagaRepository<SubscriptionClientSaga>();

            using (var serviceBus =
                ServiceBusFactory.New(sbc =>
                {
                    sbc.UseStomp();

                    sbc.ReceiveFrom("{0}/mt_subscriptions".FormatWith(Constants.HostUri));
                    sbc.SetConcurrentConsumerLimit(1);
                }))
            {
                using (var subscriptionService = new Services.Subscriptions.Server.SubscriptionService(serviceBus, subscriptionSagaRepository,
                                                                  clientSagaRepository))
                {
                    subscriptionService.Start();
                    Console.WriteLine("ready... type 'exit' to stop");
                    while (Console.ReadLine() != "exit")
                    {
                        Console.WriteLine("type 'exit' to stop");
                    }
                }
            }
        }
        public MetadataPipelineIntegrationTests()
        {
            initialisationTime   = new DateTime(1905, 9, 13);
            TimeProvider.Current = new StubTimeProvider(initialisationTime);

            var container = new TinyIoCContainer();

            container.RegisterSagas(typeof(MetadataPipelineIntegrationTests).Assembly);
            var serviceLocator = new TinyIocSagaFactory(container);


            var jsonNetSerialiser = new JsonNetSerialiser();
            var sagaRepository    = new InMemorySagaRepository(jsonNetSerialiser, serviceLocator);
            var hooks             = new IPipelineHook[] { new MetadataPipelineHook(jsonNetSerialiser) };

            var sagaMediator = new SagaMediator(sagaRepository, serviceLocator, hooks);

            correlationId = Guid.NewGuid();
            var initiatingMessage = new MySagaInitiatingMessage(correlationId);

            sagaMediator.Consume(initiatingMessage);
            var saga = sagaRepository.Find <MySaga>(correlationId);

            sagaMetadata = saga.GetSagaMetadata(new JsonNetSerialiser());
        }
Exemplo n.º 8
0
        public static Task <Guid?> ShouldContainSaga <TSaga>(this InMemorySagaRepository <TSaga> repository, Guid sagaId, TimeSpan timeout)
            where TSaga : class, ISaga
        {
            IQuerySagaRepository <TSaga> querySagaRepository = repository;

            return(querySagaRepository.ShouldContainSaga(sagaId, timeout));
        }
        static void Main(string[] args)
        {
            Console.Title = "Saga";
            var orderSaga = new OrderSaga();
            var repo      = new InMemorySagaRepository <OrderSagaState>();

            var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
            {
                var host = cfg.Host(new Uri("rabbitmq://localhost/"), h =>
                {
                    h.Username("guest");
                    h.Password("guest");
                });

                cfg.ReceiveEndpoint(host, "trendyol_saga_state", e =>
                {
                    e.PrefetchCount = 1;
                    //e.Durable = false;
                    //e.AutoDelete = true;
                    //e.ExchangeType = "fanout";//direct
                    e.StateMachineSaga(orderSaga, repo);
                    e.UseMessageRetry((t) => t.Immediate(5));

                    e.Consumer <OrderStockedFaultConsumer>();
                });
                cfg.UseRetry(t => t.Immediate(5));
                //cfg.UseInMemoryOutbox();
            });

            busControl.StartAsync();

            Console.WriteLine("Order saga started..");
            Console.ReadLine();
        }
Exemplo n.º 10
0
        public static SagaTestHarness <T> Saga <T>(this BusTestHarness harness)
            where T : class, ISaga
        {
            var repository = new InMemorySagaRepository <T>();

            return(new SagaTestHarness <T>(harness, repository));
        }
Exemplo n.º 11
0
        public void Setup()
        {
            _repository = new InMemorySagaRepository <SimpleSaga>();
            var initiatePolicy = new InitiatingSagaPolicy <SimpleSaga, InitiateSimpleSaga>(x => x.CorrelationId, x => false);

            _sagaId       = CombGuid.Generate();
            _initiateSaga = new InitiateSimpleSaga {
                CorrelationId = _sagaId, Name = "Chris"
            };
            var context = _initiateSaga.ToConsumeContext();

            _repository.GetSaga(context, _sagaId,
                                (i, c) => InstanceHandlerSelector.ForInitiatedBy <SimpleSaga, InitiateSimpleSaga>(i), initiatePolicy)
            .Each(x => x(context));

            _initiateOtherSaga = new InitiateSimpleSaga {
                CorrelationId = _otherSagaId, Name = "Dru"
            };

            _otherSagaId = Guid.NewGuid();
            context      = _initiateOtherSaga.ToConsumeContext();
            _repository.GetSaga(context, _otherSagaId,
                                (i, c) => InstanceHandlerSelector.ForInitiatedBy <SimpleSaga, InitiateSimpleSaga>(i), initiatePolicy)
            .Each(x => x(context));

            _observeSaga = new ObservableSagaMessage {
                Name = "Chris"
            };
        }
Exemplo n.º 12
0
        public SagaMediatorInitiationsTests()
        {
            var serviceLocator = new DumbServiceLocator();

            repository = new InMemorySagaRepository(new JsonNetSerialiser(), serviceLocator);
            sut        = new SagaMediator(repository, serviceLocator, typeof(SagaMediatorInitiationsTests).Assembly);
        }
Exemplo n.º 13
0
        public static async Task run()
        {
            var machine    = new OrderStateMachine();
            var repository = new InMemorySagaRepository <OrderState>();

            var busControl = Bus.Factory.CreateUsingInMemory(cfg =>
            {
                cfg.ReceiveEndpoint("order", e =>
                {
                    e.StateMachineSaga(machine, repository);
                }
                                    );
            }
                                                             );

            await busControl.StartAsync();

            var orderId = NewId.NextGuid();

            await busControl.Publish <SubmitOrder>(new
            {
                OrderId = orderId
            });

            await busControl.Publish <OrderAccepted>(new
            {
                OrderId = orderId
            });

            await busControl.StopAsync();
        }
        protected override void EstablishContext()
        {
            base.EstablishContext();

            var sagaRepository = new InMemorySagaRepository<ClaimRequestSaga>();

            //these subscriptions are to replace the Timeout Service
            RemoteBus.SubscribeHandler<ScheduleTimeout>(
                x =>
                {
                    RemoteBus.ShouldHaveSubscriptionFor<TimeoutScheduled>();
                    RemoteBus.Publish(new TimeoutScheduled{CorrelationId = x.CorrelationId, TimeoutAt = x.TimeoutAt});
                });

            RemoteBus.SubscribeHandler<CancelTimeout>(
                x =>
                    {
                        RemoteBus.ShouldHaveSubscriptionFor<TimeoutCancelled>();
                        RemoteBus.Publish(new TimeoutCancelled{CorrelationId = x.CorrelationId});
                    }
                );

            //RemoteBus.SubscribeHandler<ClaimRequestCreatedPendingVerificationEvent>(x =>
            //    {
            //        Debug.WriteLine("Claim Created Pending Verification event received.");
            //    });

            RemoteBus.SubscribeSaga(sagaRepository);

            //event messages that the Saga is subscribed to
            LocalBus.ShouldHaveSubscriptionFor<ClaimRequestCreatedPendingVerificationEvent>();
            LocalBus.ShouldHaveSubscriptionFor<CardUseVerifiedEvent>();
            LocalBus.ShouldHaveSubscriptionFor<TimeoutExpired>();
        }
Exemplo n.º 15
0
        protected override void ConfigureSubscriptions(SubscriptionBusServiceConfigurator configurator)
        {
            _machine    = new TestStateMachine();
            _repository = new InMemorySagaRepository <Instance>();

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 16
0
        public static SagaTestHarness <T> Saga <T>(this BusTestHarness harness, string queueName = null)
            where T : class, ISaga
        {
            var repository = new InMemorySagaRepository <T>();

            return(new SagaTestHarness <T>(harness, repository, queueName));
        }
        private void ConfigureSagaEndPoint(IRabbitMqReceiveEndpointConfigurator endpointConfigurator)
        {
            var stateMachine = new AutocallablePricingStateMachine();
            var repository   = new InMemorySagaRepository <AutocallablePricingState>();

            endpointConfigurator.StateMachineSaga(stateMachine, repository);
        }
Exemplo n.º 18
0
        protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _bookingRequestSagaRepository = new InMemorySagaRepository <BookingRequestState>();
            _bookingRequestStateMachine   = new BookingRequestStateMachine();

            configurator.StateMachineSaga(_bookingRequestStateMachine, _bookingRequestSagaRepository);
        }
Exemplo n.º 19
0
        protected static InMemorySagaRepository <TSaga> SetupSagaRepository <TSaga>()
            where TSaga : class, ISaga
        {
            var sagaRepository = new InMemorySagaRepository <TSaga>();

            return(sagaRepository);
        }
Exemplo n.º 20
0
		protected override void ConfigureLocalBus(ServiceBusConfigurator configurator)
		{
			base.ConfigureLocalBus(configurator);

			_timeoutSagaRepository = SetupSagaRepository<TimeoutSaga>();

			configurator.Subscribe(s => { s.Saga(_timeoutSagaRepository); });
		}
        protected override void ConfigureInputQueueEndpoint(IReceiveEndpointConfigurator configurator)
        {
            _clearingApi = Substitute.For<IClearingApi>();
            _machine = new ClearingSaga(_clearingApi);
            _repository = new InMemorySagaRepository<ClearingSagaState>();

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 22
0
        protected override void ConfigureLocalBus(IServiceBusConfigurator configurator)
        {
            base.ConfigureLocalBus(configurator);

            _timeoutSagaRepository = SetupSagaRepository <TimeoutSaga>();

            configurator.Subscribe(s => { s.Saga(_timeoutSagaRepository); });
        }
Exemplo n.º 23
0
        public void SetUp()
        {
            _sagaId = Guid.NewGuid();

            _repository = new InMemorySagaRepository <SimpleSaga>();

            Bus.ConnectSaga(_repository);
        }
            protected override void ConfigureServiceBusReceiveEndpoint(IServiceBusReceiveEndpointConfigurator configurator)
            {
                _repository = new InMemorySagaRepository <TestState>();

                _machine = new TestStateMachine();

                configurator.StateMachineSaga(_machine, _repository);
            }
Exemplo n.º 25
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInMemoryReceiveEndpoint(configurator);

            _sagaRepository = new InMemorySagaRepository <ProvisionUserWithSingleGroupSagaState>();
            _saga           = new ProvisionUserWithSingleGroupSaga();
            configurator.StateMachineSaga(_saga, _sagaRepository);
        }
Exemplo n.º 26
0
        protected override void ConfigureInputQueueEndpoint(IReceiveEndpointConfigurator configurator)
        {
            _clearingApi = Substitute.For <IClearingApi>();
            _machine     = new ClearingSaga(_clearingApi);
            _repository  = new InMemorySagaRepository <ClearingSagaState>();

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 27
0
        protected override void ConfigureInMemoryReceiveEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _repository = new InMemorySagaRepository<LegacySaga>();

            configurator.Saga(_repository, x =>
            {
                x.Message<CreateSaga>(m => m.UsePartitioner(4, p => p.Message.CorrelationId));
            });
        }
        public void find_from_empty_state()
        {
            var repository = InMemorySagaRepository <FakeState, FakeMessage> .Create();

            repository.Find(new FakeMessage {
                CorrelationId = Guid.NewGuid()
            })
            .ShouldBeNull();
        }
Exemplo n.º 29
0
        protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            _machine    = new TestStateMachine();
            _repository = new InMemorySagaRepository <Instance>();

            configurator.UseRetry(Retry.Except <NotSupportedException>().Immediate(2));

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 30
0
        protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInputQueueEndpoint(configurator);

            _repository = new InMemorySagaRepository <Instance>();
            _machine    = new DeadlockStateMachine();

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 31
0
        public static InMemorySagaRepository <TSaga> SetupSagaRepository <TSaga>(this IObjectBuilder builder)
            where TSaga : class, ISaga
        {
            var repository = new InMemorySagaRepository <TSaga>();

            builder.Add <ISagaRepository <TSaga> >(repository);

            return(repository);
        }
        protected override void ConfigureInputQueueEndpoint(IReceiveEndpointConfigurator configurator)
        {
            _accountingLogicFacade = Substitute.For<IAccountingLogicFacade>();
            var requestSettings = Substitute.For<RequestSettings>();
            _machine = new GatewaySaga(new DepositResponseFactory(), new ClearingRequestFactory(), _accountingLogicFacade, requestSettings);
            _repository = new InMemorySagaRepository<GatewaySagaState>();

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 33
0
        public BatchStateMachineTests()
        {
            _sagaRepository = new InMemorySagaRepository <BatchState>();
            _stateMachine   = new BatchStateMachine();

            _testHarness = new InMemoryTestHarness();
            _testHarness.OnConfigureInMemoryReceiveEndpoint += ConfigureInMemoryReceiveEndpoint;
            _testHarness.OnConfigureInMemoryBus             += ConfigureInMemoryBus;
        }
Exemplo n.º 34
0
        public static async Task Main()
        {
            var config = Utils.Configuration.GetServiceBusConfiguration();

            Console.Title = config.QueueName;

            var bus = Bus.Factory.CreateUsingRabbitMq(cfg =>
            {
                var host = Utils.HostFactory.CreateHost(cfg);

                cfg.ReceiveEndpoint(config.QueueName + "Endpoint", ep =>
                {
                    ep.Handler <Models.Message>(context => Console.Out.WriteLineAsync($"Received from Endpoint: {context.Message.Text}"));
                });

                cfg.ReceiveEndpoint(config.QueueName + "Subscriber", ep =>
                {
                    ep.Consumer <Consumers.TestConsumer>();
                });
            });
            var client = CreateRequestClient(bus, $"{config.ServerName}/{config.VirtualHost}/{config.QueueName}Subscriber");

            var stateMachine = new TestStateMachine();
            var repository   = new InMemorySagaRepository <TestState>();

            bus.ConnectReceiveEndpoint(config.QueueName, cfg =>
            {
                cfg.StateMachineSaga <TestState>(stateMachine, repository);
            });

            EndpointConvention.Map <Models.Message>(new Uri($"{config.ServerName}/{config.VirtualHost}/{config.QueueName}Endpoint"));

            await bus.StartAsync();

            await bus.Send(new Models.Message {
                Text = "Hello send"
            });

            await bus.Publish(new Models.Message {
                Text = "Hello publish"
            });


            var response = await client.Request(new Models.Message
            {
                CorrelationId = Guid.NewGuid(),
                Text          = "RPC Message"
            });

            Console.WriteLine("RPC Result: {0}", response.ResponseText);

            Console.WriteLine("Press any key to exit");
            await Task.Run(Console.ReadKey);

            await bus.StopAsync();
        }
Exemplo n.º 35
0
        protected override void ConfigureInputQueueEndpoint(IReceiveEndpointConfigurator configurator)
        {
            var sagaRepository = new InMemorySagaRepository<RegisterUserSaga>();
            configurator.Saga(sagaRepository);

            configurator.Handler<SendUserVerificationEmail>(async x =>
            {
                await Bus.Publish(new UserVerificationEmailSent(x.Message.CorrelationId, x.Message.Email));
            });
        }
        protected override void ConfigureInputQueueEndpoint(IReceiveEndpointConfigurator configurator)
        {
            _accountingLogicFacade = Substitute.For <IAccountingLogicFacade>();
            var requestSettings = Substitute.For <RequestSettings>();

            _machine    = new GatewaySaga(new DepositResponseFactory(), new ClearingRequestFactory(), _accountingLogicFacade, requestSettings);
            _repository = new InMemorySagaRepository <GatewaySagaState>();

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 37
0
        public SagaMediatorConsumingTests()
        {
            var container = new TinyIoCContainer();

            container.RegisterSagas(typeof(SagaMediatorConsumingTests).Assembly);
            var serviceLocator = new TinyIocSagaFactory(container);

            repository = new InMemorySagaRepository(new JsonNetSerialiser(), serviceLocator);
            sut        = new SagaMediator(repository, serviceLocator, new[] { new NullPipelineHook() });
        }
        protected override void ConfigureInputQueueEndpoint(IInMemoryReceiveEndpointConfigurator configurator)
        {
            base.ConfigureInputQueueEndpoint(configurator);

            _repository = new InMemorySagaRepository<Request_Specs.TestState>();

            var settings = new RequestSettingsImpl(ServiceQueueAddress, QuartzQueueAddress, TimeSpan.FromSeconds(1));

            _machine = new TestStateMachine(settings);

            configurator.StateMachineSaga(_machine, _repository);
        }
Exemplo n.º 39
0
		public void Setup()
		{
			_sagaId = CombGuid.Generate();

			_repository = new InMemorySagaRepository<TestSaga>();

			var initiatePolicy = new InitiatingSagaPolicy<TestSaga, PingMessage>(x => false);


			var message = new PingMessage(_sagaId);
			_repository.Send(x => x.CorrelationId == message.CorrelationId, initiatePolicy, message, saga => saga.Name = "Joe");
			
			message = new PingMessage(CombGuid.Generate());
			_repository.Send(x => x.CorrelationId == message.CorrelationId, initiatePolicy, message, saga => saga.Name = "Chris");
		}
Exemplo n.º 40
0
		public void Setup()
		{
			_repository = new InMemorySagaRepository<SimpleSaga>();
			var initiatePolicy = new InitiatingSagaPolicy<SimpleSaga,InitiateSimpleSaga>(x => false);

			_sagaId = CombGuid.Generate();
			_initiateSaga = new InitiateSimpleSaga { CorrelationId = _sagaId, Name = "Chris" };
			_repository.Send(x => x.CorrelationId == _sagaId, initiatePolicy, _initiateSaga, saga => saga.Consume(_initiateSaga));

			_initiateOtherSaga = new InitiateSimpleSaga {CorrelationId = _otherSagaId, Name = "Dru"};

			_otherSagaId = Guid.NewGuid();
			_repository.Send(x => x.CorrelationId == _otherSagaId, initiatePolicy, _initiateOtherSaga, saga => saga.Consume(_initiateOtherSaga));
	
			_observeSaga = new ObservableSagaMessage {Name = "Chris"};
		}
Exemplo n.º 41
0
        private static void StartSubscriptionService()
        {
            Console.Out.WriteLine("starting the subscription service");

            var subscriptionSagaRepository = new InMemorySagaRepository<SubscriptionSaga>();
            var clientSagaRepository = new InMemorySagaRepository<SubscriptionClientSaga>();

            var serviceBus =
                ServiceBusFactory.New(sbc =>
                                          {
                                              sbc.UseStomp();

                                              sbc.ReceiveFrom("{0}/mt_subscriptions".FormatWith(Host));
                                              sbc.SetConcurrentConsumerLimit(1);
                                          });

            var subscriptionService = new SubscriptionService(serviceBus, subscriptionSagaRepository,
                                                              clientSagaRepository);
            subscriptionService.Start();
        }
        private string StartSubscriptionService(TransportSettings settings)
        {
            string subscriptionQueueUri = settings.GetQueueUri(SubscriptionServiceQueueName ?? STR_DefaultSubscriptionServiceQueueName);

            //
            // setup the subscription service
            //
            var subscriptionBus = ServiceBusFactory.New(sbc =>
            {
                sbc.UseRabbitMq();
                sbc.SetConcurrentConsumerLimit(1);

                sbc.ReceiveFrom(subscriptionQueueUri);
            });

            var subscriptionSagas = new InMemorySagaRepository<SubscriptionSaga>();
            var subscriptionClientSagas = new InMemorySagaRepository<SubscriptionClientSaga>();
            var subscriptionService = new SubscriptionService(subscriptionBus, subscriptionSagas, subscriptionClientSagas);

            subscriptionService.Start();
            return subscriptionQueueUri;
        }
Exemplo n.º 43
0
		public void Setup()
		{
			_repository = new InMemorySagaRepository<SimpleSaga>();
			var initiatePolicy = new InitiatingSagaPolicy<SimpleSaga, InitiateSimpleSaga>(x => x.CorrelationId, x => false);

			_sagaId = CombGuid.Generate();
			_initiateSaga = new InitiateSimpleSaga {CorrelationId = _sagaId, Name = "Chris"};
			var context = _initiateSaga.ToConsumeContext();
			_repository.GetSaga(context, _sagaId,
				(i, c) => InstanceHandlerSelector.ForInitiatedBy<SimpleSaga, InitiateSimpleSaga>(i), initiatePolicy)
				.Each(x => x(context));

			_initiateOtherSaga = new InitiateSimpleSaga {CorrelationId = _otherSagaId, Name = "Dru"};

			_otherSagaId = Guid.NewGuid();
			context = _initiateOtherSaga.ToConsumeContext();
			_repository.GetSaga(context, _otherSagaId,
				(i, c) => InstanceHandlerSelector.ForInitiatedBy<SimpleSaga, InitiateSimpleSaga>(i), initiatePolicy)
				.Each(x => x(context));

			_observeSaga = new ObservableSagaMessage {Name = "Chris"};
		}
Exemplo n.º 44
0
		public void Setup()
		{
			_sagaId = CombGuid.Generate();

			_repository = new InMemorySagaRepository<TestSaga>();

			var initiatePolicy = new InitiatingSagaPolicy<TestSaga, InitiateSimpleSaga>(x => x.CorrelationId, x => false);


			var message = new InitiateSimpleSaga(_sagaId);

			IConsumeContext<InitiateSimpleSaga> context = message.ToConsumeContext();
			_repository.GetSaga(context, message.CorrelationId,
				(i, c) => InstanceHandlerSelector.ForDataEvent(i, TestSaga.Initiate), initiatePolicy)
				.Each(x => x(context));

			message = new InitiateSimpleSaga(CombGuid.Generate());
			context = message.ToConsumeContext();
			_repository.GetSaga(context, message.CorrelationId,
				(i, c) => InstanceHandlerSelector.ForDataEvent(i, TestSaga.Initiate), initiatePolicy)
				.Each(x => x(context));
		}
Exemplo n.º 45
0
 public SagaExpression_Specs()
 {
     _repository = new InMemorySagaRepository<SimpleSaga>();
 }
Exemplo n.º 46
0
 public When_an_initiating_and_observed_message_for_a_saga_arrives()
 {
     _repository = new InMemorySagaRepository<SimpleSaga>();
 }
Exemplo n.º 47
0
        public void SetUp()
        {
            _sagaId = Guid.NewGuid();

            _repository = new InMemorySagaRepository<SimpleSaga>();

            Bus.ConnectSaga(_repository);
        }
Exemplo n.º 48
0
 public When_an_initiating_message_for_an_existing_saga_arrives()
 {
     _repository = new InMemorySagaRepository<SimpleSaga>();
 }