Example #1
0
        private static void ConfigurePublisher()
        {
            log4net.Config.XmlConfigurator.Configure();

            var cfg = new CronusSettings(container)
                      .UseContractsFromAssemblies(new Assembly[] { Assembly.GetAssembly(typeof(RegisterAccount)), Assembly.GetAssembly(typeof(CreateUser)), Assembly.GetAssembly(typeof(ProjectionVersionManagerId)) })
                      .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");

            var collaborationProjections = typeof(Collaboration.Users.Projections.UserProjection).Assembly.GetTypes().Where(x => typeof(IProjectionDefinition).IsAssignableFrom(x));

            cfg.ConfigureCassandraProjectionsStore(x => x
                                                   .SetProjectionsConnectionString("Contact Points=docker-local.com;Port=9042;Default Keyspace=cronus_sample_20180213")
                                                   .SetProjectionTypes(collaborationProjections));

            (cfg as ISettingsBuilder).Build();

            var serializer = container.Resolve <ISerializer>();

            commandPublisher = (container.Resolve <ITransport>() as AzureBusTransport).GetPublisher <ICommand>(serializer);
        }