protected override void OnStart(string[] args) { _logger.Info("Starting read model service"); _setup = new Setup(); _setup.WithThreadStaticTenantContext(); _setup.RegisterReadModelServices(); _setup.WithMongo("MongoConnectionReadModel"); _setup.RegisterReadModelRepositories(); #if DEBUG _setup.WithRabbitMqBus(); #else _setup.WithAzureBus(); #endif _setup.RegisterReadModelHandlers(); _logger.Info("Registering services finished"); _logger.Info("Starting bus"); _setup.StartBus(ConfigurationManager.AppSettings["serviceBusEndpoint"]); }
public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; _logger.Info("Starting read model workerrole"); _setup = new Setup(); _setup.WithThreadStaticTenantContext(); _setup.RegisterReadModelServices(); _setup.WithMongo("MongoConnectionReadModel"); _setup.RegisterReadModelRepositories(); #if DEBUG _setup.WithRabbitMqBus(); #else _setup.WithAzureBus(); #endif _setup.RegisterReadModelHandlers(); _logger.Info("Registering services finished"); _logger.Info("Starting bus"); _setup.StartBus(ConfigurationManager.AppSettings["serviceBusEndpoint"]); return base.OnStart(); }
static void Main(string[] args) { _logger.Info("Starting read model console"); using (var setup = new Setup()) { setup.WithThreadStaticTenantContext(); setup.RegisterReadModelServices(); setup.WithMongo("MongoConnectionReadModel"); setup.RegisterReadModelRepositories(); #if DEBUG setup.WithRabbitMqBus(); #else setup.WithAzureBus(); #endif setup.RegisterReadModelHandlers(); setup.WithMongoEventStore("MongoConnectionEventStore", null, null, true); //if (args.Any(a => a.ToLower().Contains("rebuild"))) //{ // using (var scope = container.BeginLifetimeScope()) // { // RegisterEventStore(scope); // scope.Resolve<IRebuild>().FromEventStore(); // } //} _logger.Info("Registering services finished"); _logger.Info("Starting bus"); setup.StartBus(ConfigurationManager.AppSettings["serviceBusEndpoint"]); System.Console.Read(); _logger.Info("Ending the read model console"); } }