static void UseCronusHostWithCosmosEventStore() { var container = new Container(); var cfg = new CronusSettings(container) .UseCluster(cluster => cluster.UseAggregateRootAtomicAction(atomic => atomic.WithInMemory())) .UseContractsFromAssemblies(new[] { Assembly.GetAssembly(typeof(AccountRegistered)), Assembly.GetAssembly(typeof(UserCreated)) }); string IAA = "IAA"; var IAA_appServiceFactory = new ApplicationServiceFactory(container, IAA); cfg.UseCommandConsumer(IAA, consumer => consumer .UseRabbitMqTransport(x => x.Server = "docker-local.com") .SetNumberOfConsumerThreads(1) .WithDefaultPublishers() .UseCosmosEventStore(eventStore => eventStore .SetDocumentclient(new Uri("https://localhost:8081"), "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==") .SetThroughput(2500) .WithNewStorageIfNotExists()) .UseApplicationServices(cmdHandler => cmdHandler.RegisterHandlersInAssembly(new[] { typeof(AccountAppService).Assembly }, IAA_appServiceFactory.Create))); string COLL = "COLL"; var COLL_appServiceFactory = new ApplicationServiceFactory(container, COLL); cfg.UseCommandConsumer(COLL, consumer => consumer .UseRabbitMqTransport(x => x.Server = "docker-local.com") .SetNumberOfConsumerThreads(1) .WithDefaultPublishers() .UseCosmosEventStore(eventStore => eventStore .SetDocumentclient(new Uri("https://localhost:8081"), "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==") .SetThroughput(2500) .WithNewStorageIfNotExists()) .UseApplicationServices(cmdHandler => cmdHandler.RegisterHandlersInAssembly(new[] { typeof(UserAppService).Assembly }, COLL_appServiceFactory.Create))); (cfg as ISettingsBuilder).Build(); host = container.Resolve <CronusHost>(); host.Start(); }
static void UseCronusHostWithCassandraEventStore() { var container = new Container(); var cfg = new CronusSettings(container) .UseCluster(cluster => { cluster.ClusterName = "playground"; cluster.CurrentNodeName = "node1"; cluster.UseAggregateRootAtomicAction(atomic => atomic.WithInMemory()); }) .UseContractsFromAssemblies(new[] { Assembly.GetAssembly(typeof(AccountRegistered)), Assembly.GetAssembly(typeof(UserCreated)), Assembly.GetAssembly(typeof(ProjectionVersionManagerId)) }); string SYSTEM = "SYSTEM"; var SYSTEM_appServiceFactory = new ServiceLocator(container, SYSTEM); cfg.UseCommandConsumer(SYSTEM, consumer => consumer .UseAzureServiceBusTransport(x => { x.ClientId = "162af3b1-ed60-4382-8ce8-a1199e0b5c31"; x.ClientSecret = "Jej7RF6wTtgTOoqhZokc+gROk2UovFaL+zG1YF2/ous="; x.ResourceGroup = "mvclientshared.integration.all"; x.SubscriptionId = "b12a87ce-85b9-4780-afac-cc4295574db4"; x.TenantId = "a43960df-8c6f-4854-8628-7f61120c33f8"; x.ConnectionString = "Endpoint=sb://mvclientshared-integration-all-srvbus-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=BQNROS3Pw8i5YIsoAclpWbkgHrZvUdPqlJdS/RCVc9c="; x.Namespace = "mvclientshared-integration-all-srvbus-namespace"; }) //.UseRabbitMqTransport(x => x.Server = "docker-local.com") .WithDefaultPublishers() .UseCassandraEventStore(eventStore => eventStore .SetConnectionString(ConfigurationManager.ConnectionStrings["cronus_es"].ConnectionString) .SetAggregateStatesAssembly(typeof(ProjectionVersionManagerAppService))) .UseSystemServices(cmdHandler => cmdHandler.RegisterHandlersInAssembly(new[] { typeof(ProjectionVersionManagerAppService).Assembly }, SYSTEM_appServiceFactory.Resolve)) ); //Endpoint = sb://mvclientshared-integration-all-srvbus-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=BQNROS3Pw8i5YIsoAclpWbkgHrZvUdPqlJdS/RCVc9c= string IAA = "IAA"; var IAA_appServiceFactory = new ServiceLocator(container, IAA); cfg.UseCommandConsumer(IAA, consumer => consumer .UseAzureServiceBusTransport(x => { x.ClientId = "162af3b1-ed60-4382-8ce8-a1199e0b5c31"; x.ClientSecret = "Jej7RF6wTtgTOoqhZokc+gROk2UovFaL+zG1YF2/ous="; x.ResourceGroup = "mvclientshared.integration.all"; x.SubscriptionId = "b12a87ce-85b9-4780-afac-cc4295574db4"; x.TenantId = "a43960df-8c6f-4854-8628-7f61120c33f8"; x.ConnectionString = "Endpoint=sb://mvclientshared-integration-all-srvbus-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=BQNROS3Pw8i5YIsoAclpWbkgHrZvUdPqlJdS/RCVc9c="; x.Namespace = "mvclientshared-integration-all-srvbus-namespace"; }) //.UseRabbitMqTransport(x => x.Server = "docker-local.com") //.UseAzureServiceBus .SetNumberOfConsumerThreads(5) .WithDefaultPublishers() .UseCassandraEventStore(eventStore => eventStore .SetConnectionString(ConfigurationManager.ConnectionStrings["cronus_es"].ConnectionString) .SetAggregateStatesAssembly(typeof(AccountState))) .UseApplicationServices(cmdHandler => cmdHandler.RegisterHandlersInAssembly(new[] { typeof(AccountAppService).Assembly }, IAA_appServiceFactory.Resolve)) ); string COLL = "COLL"; var COLL_appServiceFactory = new ServiceLocator(container, COLL); cfg.UseCommandConsumer(COLL, consumer => consumer .UseAzureServiceBusTransport(x => { x.ClientId = "162af3b1-ed60-4382-8ce8-a1199e0b5c31"; x.ClientSecret = "Jej7RF6wTtgTOoqhZokc+gROk2UovFaL+zG1YF2/ous="; x.ResourceGroup = "mvclientshared.integration.all"; x.SubscriptionId = "b12a87ce-85b9-4780-afac-cc4295574db4"; x.TenantId = "a43960df-8c6f-4854-8628-7f61120c33f8"; x.ConnectionString = "Endpoint=sb://mvclientshared-integration-all-srvbus-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=BQNROS3Pw8i5YIsoAclpWbkgHrZvUdPqlJdS/RCVc9c="; x.Namespace = "mvclientshared-integration-all-srvbus-namespace"; }) //.UseRabbitMqTransport(x => x.Server = "docker-local.com") .SetNumberOfConsumerThreads(5) .WithDefaultPublishers() .UseCassandraEventStore(eventStore => eventStore .SetConnectionString(ConfigurationManager.ConnectionStrings["cronus_es"].ConnectionString) .SetAggregateStatesAssembly(typeof(UserState))) .UseApplicationServices(cmdHandler => cmdHandler.RegisterHandlersInAssembly(new[] { typeof(UserAppService).Assembly }, COLL_appServiceFactory.Resolve)) ); (cfg as ISettingsBuilder).Build(); host = container.Resolve <CronusHost>(); host.Start(); }