protected override void OnStart(string[] args) { string componentConfig = ConfigurationManager.AppSettings["NGinnMessageBus.ServiceHost.ComponentConfig"]; bool section = ConfigurationManager.GetSection(componentConfig) != null; WindsorContainer wc = null; if (!string.IsNullOrEmpty(componentConfig)) { if (section) { wc = new WindsorContainer(new XmlInterpreter(new ConfigResource(componentConfig))); } else if (Path.GetExtension(componentConfig) == "xml" || Path.GetExtension(componentConfig) == ".xml") { log.Info("Configuring the container from xml file: {0}", componentConfig); wc = new WindsorContainer(new XmlInterpreter(new FileResource(componentConfig, AppDomain.CurrentDomain.BaseDirectory))); } else { throw new Exception("Don't know how to load config: " + componentConfig); } } else { wc = new WindsorContainer(); } _host = MessageBusConfigurator.Begin(wc) .ConfigureFromAppConfig() .AutoStartMessageBus(true) .FinishConfiguration(); }
public static IWindsorContainer ConfigureMessageBus(string endpointName, IDictionary <string, string> dbConnectionStrings) { 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(Setup).Assembly) .UseSqlSequenceManager() .SetEnableSagas(false) .SetSendOnly(false) .SetMaxConcurrentMessages(1) .SetUseTransactionScope(true) .SetAlwaysPublishLocal(false) .SetReuseReceiveConnectionForSending(true) .SetExposeReceiveConnectionToApplication(true) .SetDefaultSubscriptionLifetime(TimeSpan.FromHours(8)) .AutoStartMessageBus(true); cfg.FinishConfiguration(); return(cfg.Container); }
public static IWindsorContainer ConfigureTheBus() { return(MessageBusConfigurator.Begin() .ConfigureFromAppConfig() .AutoStartMessageBus(true) .FinishConfiguration() .Container); }
void Application_Start(object sender, EventArgs e) { this.mc = MessageBusConfigurator.Begin() .ConfigureFromAppConfig() .UseSqlSubscriptions() .FinishConfiguration() .StartMessageBus(); MessageBus = mc.GetMessageBus(); }
public static IWindsorContainer ConfigureTheBusSendOnly() { return(MessageBusConfigurator.Begin() .ConfigureFromAppConfig() .AutoStartMessageBus(true) .UseStaticMessageRouting("routing.json") .SetSendOnly(true) .FinishConfiguration() .Container); }
public static IMessageBus ConfigureMongoBus() { IMessageBus bus = MessageBusConfigurator.Begin() .SetEndpoint("mongodb://localhost:27017/cogmon?queueName=Queue1") .SetEnableSagas(true) .SetMaxConcurrentMessages(8) .SetReuseReceiveConnectionForSending(true) .UseMongoDb() .AddMessageHandlersFromAssembly(typeof(MongoQueue).Assembly) .AutoStartMessageBus(true) .FinishConfiguration() .GetMessageBus(); return(bus); }
public static IWindsorContainer Configure(string endpoint, bool sendOnly) { var mc = MessageBusConfigurator.Begin() .ConfigureFromAppConfig() .SetEndpoint(endpoint) .SetSendOnly(sendOnly) .AddMessageHandlersFromAssembly(typeof(Program).Assembly) .AutoStartMessageBus(true) .BatchOutgoingMessages(true ) //.UseExternalHandlerContainer(new WindsorServiceResolver(null)) .FinishConfiguration(); return(mc.Container); }
public static IMessageBus ConfigureMessageBus() { var wc = MessageBusConfigurator.Begin() .ConfigureFromAppConfig() .UseStaticMessageRouting("route.json") .AutoCreateDatabase(false) .SetEnableSagas(false) .SetAlwaysPublishLocal(true) .AddMessageHandlersFromAssembly(typeof(OracleTests).Assembly) .SetMaxConcurrentMessages(1) .AutoStartMessageBus(true) .FinishConfiguration() .Container; return(wc.Resolve <IMessageBus>()); }
static void Main(string[] args) { NLog.Config.SimpleConfigurator.ConfigureForConsoleLogging(LogLevel.Warn); var mc = MessageBusConfigurator.Begin() .ConfigureFromAppConfig() .AddMessageHandlersFromAssembly(typeof(Program).Assembly) .FinishConfiguration() .StartMessageBus(); IMessageBus mb = mc.GetMessageBus(); mb.SubscribeAt(System.Configuration.ConfigurationManager.AppSettings["PublisherEndpoint"], typeof(Object)); Console.WriteLine("Subscriber at {0} ready to receive messages. Press Enter to exit", mb.Endpoint); Console.ReadLine(); Console.WriteLine("Stopping..."); mc.StopMessageBus(); }
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); }
public NGinnConfigurator FinishConfiguration() { _wc.Register(Component.For <ProcessEngine>() .ImplementedBy <ProcessEngine>() .LifeStyle.Singleton); _wc.Register(Component.For <ITaskInstancePersister>() .ImplementedBy <SqlProcessPersister>() .LifeStyle.Singleton); _wc.Register(Component.For <ITaskInstanceSerializer>() .ImplementedBy <JsonTaskInstanceSerializer>()); MessageBusConfigurator.Begin(_wc) .AddMessageHandlersFromAssembly(typeof(TaskInstance).Assembly) .AddMessageHandlersFromAssembly(typeof(NGinnConfigurator).Assembly) .ConfigureFromAppConfig() .AutoStartMessageBus(true) .FinishConfiguration(); return(this); }