public static IWindsorContainer ConfigureMessageBus(string endpointName, IDictionary <string, string> dbConnectionStrings, string httpUrl) { MessageBusConfigurator cfg = MessageBusConfigurator.Begin() .SetEndpoint(endpointName) .SetConnectionStrings(dbConnectionStrings.Select((kv, i) => new ConnectionStringSettings { Name = kv.Key, ProviderName = "System.Data.SqlClient", ConnectionString = kv.Value })) .UseSqlSubscriptions() .UseStaticMessageRouting("Routing.json") //.RegisterHttpMessageServicesFromAssembly(typeof(Program).Assembly) .AddMessageHandlersFromAssembly(typeof(Program).Assembly) .UseSqlSequenceManager() .SetEnableSagas(true) .SetSendOnly(false) .SetMaxConcurrentMessages(4) .SetUseTransactionScope(true) .SetAlwaysPublishLocal(false) .SetReuseReceiveConnectionForSending(true) .SetExposeReceiveConnectionToApplication(true) .SetDefaultSubscriptionLifetime(TimeSpan.FromHours(8)) .AutoStartMessageBus(true); if (httpUrl != null) { cfg.ConfigureHttpReceiver(httpUrl); } cfg.CustomizeContainer(delegate(IWindsorContainer wc) { /*wc.Register(Component.For<NGinnBPM.MessageBus.Impl.ISerializeMessages>() * .ImplementedBy<NGinnBPM.MessageBus.Impl.ServiceStackMessageSerializer>() * .DependsOn(new { UseFullAssemblyNames = false }) * .LifeStyle.Singleton);*/ wc.Register(Component.For <IServlet>() .ImplementedBy <FSDirectoryServlet>() .DependsOn(new { MatchUrl = @"/www/(?<id>.+)?", BaseDirectory = "c:\\inetpub\\wwwroot" }).LifeStyle.Transient); }); //cfg.ConfigureAdditionalSqlMessageBus("bus2", "sql://testdb1/MQueue2"); cfg.FinishConfiguration(); //cfg.StartMessageBus(); return(cfg.Container); }