public static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); //var sf = BuildSessionFactory(); var container = new Container(); var cfg = new CronusSettings(container) .UseContractsFromAssemblies(new Assembly[] { Assembly.GetAssembly(typeof(RegisterAccount)), Assembly.GetAssembly(typeof(CreateUser)) }) .UseProjectionConsumer(consumer => consumer .SetNumberOfConsumerThreads(5) .WithDefaultPublishersWithRabbitMq() .UseRabbitMqTransport() .UseProjections(h => h //.UseUnitOfWork(new UnitOfWorkFactory() { CreateBatchUnitOfWork = () => new BatchScope(sf) }) .RegisterAllHandlersInAssembly(Assembly.GetAssembly(typeof(UserProjection))))); //{ // return FastActivator.CreateInstance(type) // .AssignPropertySafely<IHaveNhibernateSession>(x => x.Session = context.BatchContext.Get<Lazy<ISession>>().Value); // }))); (cfg as ISettingsBuilder).Build(); host = container.Resolve<CronusHost>(); host.Start(); Console.WriteLine("Projections started"); Console.ReadLine(); host.Stop(); }
static void Main(string[] args) { //var connStr = @"amqps://*****:*****@mvclientshared-integration-all-srvbus-namespace.servicebus.windows.net"; //var gg = new AmqpTcpEndpoint(connStr); //var fact = new ConnectionFactory(){ } log4net.Config.XmlConfigurator.Configure(); UseCronusHostWithCassandraEventStore(); System.Console.WriteLine("Started command handlers"); System.Console.ReadLine(); host.Stop(); host = null; }
public static void Main(string[] args) { //Thread.Sleep(9000); log4net.Config.XmlConfigurator.Configure(); var container = new Container(); var COLL_POOOOORTHandlerFactory = new PortHandlerFactory(container, "Ports"); var cfg = new CronusSettings(container) .UseContractsFromAssemblies(new Assembly[] { Assembly.GetAssembly(typeof(RegisterAccount)), Assembly.GetAssembly(typeof(CreateUser)) }) .UseRabbitMqTransport(x => x.Server = "docker-local.com") .UsePortConsumer("Ports", consumable => consumable .WithDefaultPublishers() .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) .UsePorts(c => c.RegisterHandlersInAssembly(new[] { Assembly.GetAssembly(typeof(UserProjection)) }, COLL_POOOOORTHandlerFactory.Create))); (cfg as ISettingsBuilder).Build(); host = container.Resolve <CronusHost>(); host.Start(); Console.WriteLine("Ports started"); Console.ReadLine(); host.Stop(); }
public static void Main(string[] args) { //Thread.Sleep(9000); log4net.Config.XmlConfigurator.Configure(); var container = new Container(); var COLL_POOOOORTHandlerFactory = new PortHandlerFactory(container, null); var cfg = new CronusSettings(container) .UseContractsFromAssemblies(new Assembly[] { Assembly.GetAssembly(typeof(RegisterAccount)), Assembly.GetAssembly(typeof(CreateUser)) }) .UsePortConsumer(consumable => consumable .WithDefaultPublishersWithRabbitMq() .UseRabbitMqTransport() .SetNumberOfConsumerThreads(5) .UsePorts(c => c.RegisterAllHandlersInAssembly(Assembly.GetAssembly(typeof(UserProjection)), COLL_POOOOORTHandlerFactory.Create))); (cfg as ISettingsBuilder).Build(); host = container.Resolve<CronusHost>(); host.Start(); Console.WriteLine("Ports started"); Console.ReadLine(); host.Stop(); }
public static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); //var sf = BuildSessionFactory(); var container = new Container(); var serviceLocator = new ServiceLocator(container); //var projectionTypes = typeof(UserProjection).Assembly.GetTypes().Where(x => typeof(IProjectionDefinition).IsAssignableFrom(x)); var systemProjections = typeof(PersistentProjectionVersionHandler).Assembly.GetTypes().Where(x => typeof(IProjectionDefinition).IsAssignableFrom(x)).ToList(); var collaborationProjections = typeof(Collaboration.Users.Projections.UserProjection).Assembly.GetTypes().Where(x => typeof(IProjectionDefinition).IsAssignableFrom(x)); systemProjections.AddRange(collaborationProjections); var cfg = new CronusSettings(container) .UseCluster(cluster => { cluster.ClusterName = "playground"; cluster.CurrentNodeName = "node1"; }) .UseContractsFromAssemblies(new Assembly[] { Assembly.GetAssembly(typeof(RegisterAccount)), Assembly.GetAssembly(typeof(CreateUser)) }); var projection_serviceLocator = new ServiceLocator(container, "Projection"); cfg.UseProjectionConsumer("Projection", consumer => consumer .WithDefaultPublishers() .SetNumberOfConsumerThreads(5) .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") .UseProjections(h => h .RegisterHandlerTypes(systemProjections, projection_serviceLocator.Resolve) .UseCassandraProjections(x => x .SetProjectionsConnectionString("Contact Points=docker-local.com;Port=9042;Default Keyspace=cronus_sample_20180213") .SetProjectionTypes(systemProjections)) )); var systemSaga_serviceLocator = new ServiceLocator(container, "SystemSaga"); cfg.UseSagaConsumer("SystemSaga", consumer => consumer .WithDefaultPublishers() .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") .ConfigureCassandraProjectionsStore(proj => proj .SetProjectionTypes(typeof(ProjectionBuilder).Assembly) .SetProjectionsConnectionString("Contact Points=docker-local.com;Port=9042;Default Keyspace=cronus_sample_20180213")) .UseCassandraEventStore(eventStore => eventStore .SetConnectionString(ConfigurationManager.ConnectionStrings["cronus_es"].ConnectionString) .SetAggregateStatesAssembly(typeof(Elders.Cronus.Sample.Collaboration.Users.UserState))) .UseSystemSagas(saga => saga.RegisterHandlerTypes(new List <Type>() { typeof(ProjectionBuilder) }, systemSaga_serviceLocator.Resolve)) ); //var systemProjectionTypes = typeof(PersistentProjectionVersionHandler).Assembly.GetTypes().Where(x => typeof(IProjectionDefinition).IsAssignableFrom(x)); //var systemProj_serviceLocator = new ServiceLocator(container, "SystemProj"); //cfg.UseProjectionConsumer("SystemProj", consumer => consumer // .WithDefaultPublishers() // .UseRabbitMqTransport(x => x.Server = "docker-local.com") // .UseSystemProjections(h => h // .RegisterHandlerTypes(systemProjectionTypes, systemProj_serviceLocator.Resolve) // .UseCassandraProjections(p => p // .SetProjectionsConnectionString("Contact Points=docker-local.com;Port=9042;Default Keyspace=cronus_sample_20180213") // .SetProjectionTypes(typeof(PersistentProjectionVersionHandler).Assembly) // )) // ); (cfg as ISettingsBuilder).Build(); host = container.Resolve <CronusHost>(); host.Start(); Console.WriteLine("Projections started"); Console.ReadLine(); host.Stop(); }