protected override void DoSetUp() { timeoutService = new TimeoutService(new InMemoryTimeoutStorage()); timeoutService.Start(); handlerActivator = new HandlerActivatorForTesting(); client = CreateBus("test.rebus.timeout.client", handlerActivator).Start(1); }
protected override void EstablishContext() { base.EstablishContext(); _correlationId = NewId.NextGuid(); _timeoutSagaRepository = SetupSagaRepository <TimeoutSaga>(); _timeoutService = new TimeoutService(LocalBus, _timeoutSagaRepository); _timeoutService.Start(); }
protected override void EstablishContext() { base.EstablishContext(); _correlationId = CombGuid.Generate(); _timeoutSagaRepository = SetupSagaRepository <TimeoutSaga>(ObjectBuilder); _timeoutService = new TimeoutService(LocalBus, _timeoutSagaRepository); _timeoutService.Start(); }
protected override void EstablishContext() { base.EstablishContext(); _correlationId = CombGuid.Generate(); _timeoutSagaRepository = SetupSagaRepository<TimeoutSaga>(ObjectBuilder); _timeoutService = new TimeoutService(LocalBus, _timeoutSagaRepository); _timeoutService.Start(); }
protected override void EstablishContext() { base.EstablishContext(); _correlationId = NewId.NextGuid(); _timeoutSagaRepository = SetupSagaRepository<TimeoutSaga>(); _timeoutService = new TimeoutService(LocalBus, _timeoutSagaRepository); _timeoutService.Start(); }
protected override void DoSetUp() { handlerActivator = new HandlerActivatorForTesting(); bus = CreateBus("test.deferral", handlerActivator).Start(1); timeoutService = new TimeoutService(new InMemoryTimeoutStorage()); timeoutService.Start(); RebusLoggerFactory.Current = new ConsoleLoggerFactory(false) { MinLevel = LogLevel.Warn }; }
public void Initialize(IBusFactory busFactoryToUse) { Console.WriteLine("Purging {0}, just to be sure", TimeoutService.DefaultInputQueueName); MsmqUtil.PurgeQueue(TimeoutService.DefaultInputQueueName); //var sqlServerTimeoutStorage = new SqlServerTimeoutStorage(SqlServerFixtureBase.ConnectionString, "rebus_timeouts").EnsureTableIsCreated(); //var mongoDbTimeoutStorage = new MongoDbTimeoutStorage(MongoDbFixtureBase.ConnectionString, "timeouts"); var inMemoryTimeoutStorage = new InMemoryTimeoutStorage(); timeoutService = new TimeoutService(inMemoryTimeoutStorage); timeoutService.Start(); busFactory = busFactoryToUse; }
void Configure() { var subscriptionServiceUri = new Uri("loopback://localhost/mt_subscriptions"); var healthUri = new Uri("loopback://localhost/mt_health"); var timeoutUri = new Uri("loopback://localhost/mt_timeout"); var localUri = new Uri("loopback://localhost/local"); _subscriptionBus = SetupServiceBus(subscriptionServiceUri, configurator => configurator.SetConcurrentConsumerLimit(1)); var subscriptionSagas = new InMemorySagaRepository <SubscriptionSaga>(); var subscriptionClientSagas = new InMemorySagaRepository <SubscriptionClientSaga>(); _subscriptionService = new SubscriptionService(_subscriptionBus, subscriptionSagas, subscriptionClientSagas); _subscriptionService.Start(); _timeoutBus = SetupServiceBus(timeoutUri, configurator => { configurator.UseControlBus(); configurator.UseSubscriptionService(subscriptionServiceUri); }); _timeoutService = new TimeoutService(_timeoutBus, new InMemorySagaRepository <TimeoutSaga>()); _timeoutService.Start(); Thread.Sleep(500); _healthBus = SetupServiceBus(healthUri, configurator => { configurator.UseControlBus(); configurator.UseSubscriptionService(subscriptionServiceUri); }); _healthSagas = new InMemorySagaRepository <HealthSaga>(); _healthService = new HealthService(_healthBus, _healthSagas); _healthService.Start(); Thread.Sleep(500); _serviceBus = SetupServiceBus(localUri, configurator => { configurator.UseControlBus(); configurator.UseHealthMonitoring(1); configurator.UseSubscriptionService(subscriptionServiceUri); }); Thread.Sleep(500); }
protected override void DoSetUp() { // this is the bus hosting the saga sagaHandlerActivator = new HandlerActivatorForTesting(); sagaPersister = new InMemorySagaPersister(); sagaBus = CreateBus(SagaBusInputQueueName, sagaHandlerActivator, new InMemorySubscriptionStorage(), sagaPersister, "error").Start(1); // this is the "service bus", i.e. just some request/reply-enabled service somewhere serviceHandlerActivator = new HandlerActivatorForTesting(); serviceBus = CreateBus(ServiceBusInputQueueName, serviceHandlerActivator).Start(1); // this is just a bus from the outside that can initiate everything initiatorBus = CreateBus("test.autocorrelation.initiator", new HandlerActivatorForTesting()).Start(1); timeoutService = new TimeoutService(new InMemoryTimeoutStorage()); timeoutService.Start(); }
protected override void EstablishContext() { base.EstablishContext(); _correlationId = CombGuid.Generate(); _timeoutSagaRepository = SetupSagaRepository<TimeoutSaga>(ObjectBuilder); _timeoutService = new TimeoutService(RemoteBus, _timeoutSagaRepository); _timeoutService.Start(); _repository = new InMemoryDeferredMessageRepository(); ObjectBuilder.Stub(x => x.GetInstance<IDeferredMessageRepository>()).Return(_repository); ObjectBuilder.Stub(x => x.GetInstance<DeferMessageConsumer>()).Return(new DeferMessageConsumer(RemoteBus, _repository)); ObjectBuilder.Stub(x => x.GetInstance<TimeoutExpiredConsumer>()).Return(new TimeoutExpiredConsumer(RemoteBus, _repository)); _deferService = new MessageDeferralService(RemoteBus); _deferService.Start(); }
private void StartTimeoutService(TransportSettings settings) { // // setup the time out service // string subscriptionQueueUri = settings.GetQueueUri(SubscriptionServiceQueueName ?? STR_DefaultSubscriptionServiceQueueName); string timeoutQueueUri = settings.GetQueueUri(TimeoutServiceQueueName ?? STR_DefaultTimeoutServiceQueueName); var timeoutBus = ServiceBusFactory.New(sbc => { sbc.UseControlBus(); sbc.ReceiveFrom(timeoutQueueUri); sbc.UseSubscriptionService(subscriptionQueueUri); }); var timeoutService = new TimeoutService(timeoutBus, new InMemorySagaRepository <TimeoutSaga>()); timeoutService.Start(); }
protected override void EstablishContext() { base.EstablishContext(); _correlationId = CombGuid.Generate(); _timeoutSagaRepository = SetupSagaRepository <TimeoutSaga>(ObjectBuilder); _timeoutService = new TimeoutService(RemoteBus, _timeoutSagaRepository); _timeoutService.Start(); _repository = new InMemoryDeferredMessageRepository(); ObjectBuilder.Stub(x => x.GetInstance <IDeferredMessageRepository>()).Return(_repository); ObjectBuilder.Stub(x => x.GetInstance <DeferMessageConsumer>()).Return(new DeferMessageConsumer(RemoteBus, _repository)); ObjectBuilder.Stub(x => x.GetInstance <TimeoutExpiredConsumer>()).Return(new TimeoutExpiredConsumer(RemoteBus, _repository)); _deferService = new MessageDeferralService(RemoteBus); _deferService.Start(); }
protected override void DoSetUp() { messageQueueFactory = new TFactory(); RebusLoggerFactory.Current = new ConsoleLoggerFactory(false) { MinLevel = LogLevel.Debug, Filters = { l => true } }; crm = CreateBus("crm", ContainerAdapterWith("crm")); caf = CreateBus("caf", ContainerAdapterWith("caf", typeof(CheckCreditSaga))); legal = CreateBus("legal", ContainerAdapterWith("legal", typeof(CheckSomeLegalStuffSaga))); dcc = CreateBus("dcc", ContainerAdapterWith("dcc", typeof(MaintainCustomerInformationSaga))); // clear saga data collections DropCollection(CreditSagasCollectionName); DropCollection(LegalSagasCollectionName); DropCollection(CustomerInformationSagasCollectionName); DropCollection(TimeoutsCollectionName); var timeoutServiceQueues = messageQueueFactory.GetQueue("rebus.timeout"); timeout = new TimeoutService(new MongoDbTimeoutStorage(ConnectionString, TimeoutsCollectionName), timeoutServiceQueues.Item1, timeoutServiceQueues.Item2); timeout.Start(); caf.Subscribe <CustomerCreated>(); legal.Subscribe <CustomerCreated>(); dcc.Subscribe <CustomerCreated>(); dcc.Subscribe <CustomerCreditCheckComplete>(); dcc.Subscribe <CustomerLegallyApproved>(); Thread.Sleep(5.Seconds()); }
private void StartTimeoutService(TransportSettings settings) { // // setup the time out service // string subscriptionQueueUri = settings.GetQueueUri(SubscriptionServiceQueueName ?? STR_DefaultSubscriptionServiceQueueName); string timeoutQueueUri = settings.GetQueueUri(TimeoutServiceQueueName ?? STR_DefaultTimeoutServiceQueueName); var timeoutBus = ServiceBusFactory.New(sbc => { sbc.UseControlBus(); sbc.ReceiveFrom(timeoutQueueUri); sbc.UseSubscriptionService(subscriptionQueueUri); }); var timeoutService = new TimeoutService(timeoutBus, new InMemorySagaRepository<TimeoutSaga>()); timeoutService.Start(); }
private static void InitializeTimeoutService(ISessionFactory sessionFactory) { Console.Write("Initializing the timeout service... "); var timeoutBus = ServiceBusFactory.New(sbc => { sbc.UseMsmq(); sbc.VerifyMsmqConfiguration(); sbc.UseControlBus(); sbc.ReceiveFrom(Constants.QueueTimeouts); sbc.UseSubscriptionService(Constants.QueueSubscriptions); }); var timeoutSagaRepository = new NHibernateSagaRepository<TimeoutSaga>(sessionFactory); var timeoutService = new TimeoutService(timeoutBus, timeoutSagaRepository); timeoutService.Start(); Utils.WriteToConsole("done", ConsoleColor.Green); }
public void Initialize(IBusFactory busFactoryToUse) { timeoutService = new TimeoutService(new InMemoryTimeoutStorage()); timeoutService.Start(); busFactory = busFactoryToUse; }
public Given_Two_Buses_Using_SqlTransport() { var connection = new SqliteInMemoryConnection(); //connection.Open(); //var connectionStringResolver = new ConnectionStringResolver {ConnectionStrings = new ConnectionStringSettingsCollection {new ConnectionStringSettings("test", csSubscriptions), new ConnectionStringSettings("timeout", csTimeout)}}; //var connectionFactory = new SqliteConnectionFactory(connection); // // setup the subscription service // SubscriptionBus = ServiceBusFactory.New(sbc => { sbc.UseSql(cfg => cfg.UseConnection("test", connection)); sbc.SetConcurrentConsumerLimit(1); sbc.ReceiveFrom("sqlite://test/mt_subscriptions"); }); var subscriptionSagas = new InMemorySagaRepository <SubscriptionSaga>(); var subscriptionClientSagas = new InMemorySagaRepository <SubscriptionClientSaga>(); _subscriptionService = new SubscriptionService(SubscriptionBus, subscriptionSagas, subscriptionClientSagas); _subscriptionService.Start(); // // setup the time out service // _timeoutBus = ServiceBusFactory.New(sbc => { sbc.UseSql(cfg => { cfg.UseConnection("test", connection); cfg.UseSubscriptionService(y => y.SetSubscriptionServiceEndpoint(new Uri("sqlite://test/mt_subscriptions"))); }); //sbc.SetConcurrentConsumerLimit(1); sbc.UseControlBus(); sbc.ReceiveFrom("sqlite://test/mt_timeouts"); }); _timeoutService = new TimeoutService(_timeoutBus, new InMemorySagaRepository <TimeoutSaga>()); _timeoutService.Start(); OutboundBus = ServiceBusFactory.New(x => { x.ReceiveFrom("sqlite://test/out_queue"); x.UseControlBus(); //x.SetPurgeOnStartup(true); x.UseSql(cfg => { cfg.UseConnection("test", connection); cfg.UseSubscriptionService(y => y.SetSubscriptionServiceEndpoint(new Uri("sqlite://test/mt_subscriptions"))); }); x.SetCreateTransactionalQueues(false); //x.Subscribe(s => s.Handler<SimpleRequest>(Handle)); }); InboundBus = ServiceBusFactory.New(x => { x.ReceiveFrom("sqlite://test/in_queue"); x.UseControlBus(); //x.SetPurgeOnStartup(true); x.UseSql(cfg => { cfg.UseConnection("test", connection); cfg.UseSubscriptionService(y => y.SetSubscriptionServiceEndpoint(new Uri("sqlite://test/mt_subscriptions"))); }); x.SetCreateTransactionalQueues(false); //x.Subscribe(s => s.Handler<SimpleRequest>(Handle)); }); }