public static Container BuildEnvironment() { //JsConfig.DateHandler = JsonDateHandler.ISO8601; ConfigureObserver(); var integrationPath = AzureSettingsProvider.GetStringOrThrow(Conventions.StorageConfigName); //var email = AzureSettingsProvider.GetStringOrThrow(Conventions.SmtpConfigName); //var core = new SmtpHandlerCore(email); var setup = new Setup { //Smtp = core, //FreeApiKey = freeApiKey, //WebClientUrl = clientUri, //HttpEndpoint = endPoint, //EncryptorTool = new EncryptorTool(systemKey) }; if (integrationPath.StartsWith("file:")) { var path = integrationPath.Remove(0, 5); SystemObserver.Notify("Using store : {0}", path); var config = FileStorage.CreateConfig(path); setup.Streaming = config.CreateStreaming(); setup.DocumentStoreFactory = config.CreateDocumentStore; setup.QueueReaderFactory = s => config.CreateInbox(s, DecayEvil.BuildExponentialDecay(500)); setup.QueueWriterFactory = config.CreateQueueWriter; setup.AppendOnlyStoreFactory = config.CreateAppendOnlyStore; setup.ConfigureQueues(1, 1); return(setup.Build()); } if (integrationPath.StartsWith("Default") || integrationPath.Equals("UseDevelopmentStorage=true", StringComparison.InvariantCultureIgnoreCase)) { var config = AzureStorage.CreateConfig(integrationPath); setup.Streaming = config.CreateStreaming(); setup.DocumentStoreFactory = config.CreateDocumentStore; setup.QueueReaderFactory = s => config.CreateQueueReader(s); setup.QueueWriterFactory = config.CreateQueueWriter; setup.AppendOnlyStoreFactory = config.CreateAppendOnlyStore; setup.ConfigureQueues(4, 4); return(setup.Build()); } throw new InvalidOperationException("Unsupported environment"); }
protected override CqrsEngineHost BuildHost() { var builder = new CqrsEngineBuilder(); //NOTE: Core Lokad CQRS Initialization builder.UseProtoBufSerialization(); builder.Domain(config => { config.InAssemblyOf <CreateMessage>(); config.InAssemblyOf <CreateMessageHandler>(); config.ContextFactory(MyMessageContext.Factory); }); var storageConfig = CreateCloudStorageConfig(); builder.Azure(config => { config.AddAzureProcess(storageConfig, Queues.MESSAGES); config.AddAzureSender(storageConfig, Queues.MESSAGES); }); builder.Storage(config => config.AtomicIsInAzure(storageConfig, s => { s.WithAssemblyOf <MessageView>(); s.CustomStaticSerializer(new AtomicStorageSerializerWithProtoBuf()); })); //NOTE: Event Store Initialization builder.ConfigureJonathanOliverEventStore(config => { var connectionString = AzureSettingsProvider.GetString("EventStoreConnectionString"); config.ConnectionString(connectionString); config.Hooks(p => p.Add <MyNullPipelineHook>()); config.Snapshots(s => { //snapshotting isn't implemented correctly right now. s.Disable(); s.CheckEvery(TimeSpan.FromSeconds(30)); //set this to something reasonable like 250. //It's so low here to demonstrate background "out-of-band" snapshotting. s.MaxThreshold(2); }); }); return(builder.Build()); }