static void Main() { Console.Title = "Samples.ErrorHandling.WithSLR"; Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.ErrorHandling.WithSLR"); configure.DefaultBuilder(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus .Start(() => configure.ForInstallationOn <Windows>().Install()); Console.WriteLine("Press enter to send a message that will throw an exception."); Console.WriteLine("Press any key to exit"); while (true) { ConsoleKeyInfo key = Console.ReadKey(); if (key.Key != ConsoleKey.Enter) { return; } MyMessage m = new MyMessage { Id = Guid.NewGuid() }; bus.SendLocal(m); } } }
static void Main() { Configure.Serialization.Json(); Configure.Features.Enable <Sagas>(); Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.ComplexSagaFindingLogic"); configure.DefaultBuilder(); configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new StartOrder { OrderId = "123" }); bus.SendLocal(new StartOrder { OrderId = "456" }); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { LogManager.Use <DefaultFactory>().Level(LogLevel.Error); #region Program Logger.WriteLine("Starting configuration"); BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.StartupShutdown"); busConfiguration.EnableInstallers(); busConfiguration.UsePersistence <InMemoryPersistence>(); Logger.WriteLine("Calling Bus.Create"); using (IStartableBus bus = Bus.Create(busConfiguration)) { Logger.WriteLine("Calling IStartableBus.Create"); bus.Start(); //simulate some bus activity Thread.Sleep(500); Logger.WriteLine("Bus is processing messages"); Logger.WriteLine("Calling IStartableBus.Dispose"); } Logger.WriteLine("Finished"); #endregion Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
static void Main() { #region ConfigureLogging Common.Logging.LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter { Level = LogLevel.Info }; NServiceBus.Logging.LogManager.Use <CommonLoggingFactory>(); BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.Logging.CommonLogging"); #endregion busConfiguration.UseSerialization <JsonSerializer>(); busConfiguration.EnableInstallers(); busConfiguration.UsePersistence <InMemoryPersistence>(); using (IStartableBus bus = Bus.Create(busConfiguration)) { bus.Start(); bus.SendLocal(new MyMessage()); Console.WriteLine("\r\nPress any key to stop program\r\n"); Console.ReadKey(); } }
static void Main() { Console.Title = "Samples.Scaleout.Server"; Configure.Serialization.Json(); #pragma warning disable 618 #region server Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Scaleout.Server"); configure.DefaultBuilder(); configure.RunDistributor(withWorker: false); #endregion #pragma warning restore 618 configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { Console.Title = "Samples.OwinPassThrough"; #region startbus Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.OwinPassThrough"); configure.DefaultBuilder(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); using (StartOwinHost(bus)) { Console.WriteLine("Press any key to exit"); Console.ReadKey(); } } #endregion }
static void Main() { Configure.Serialization.Json(); Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.MessageBodyEncryption.Endpoint1"); configure.DefaultBuilder(); configure.UseTransport <Msmq>(); configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.RegisterMessageEncryptor(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); CompleteOrder completeOrder = new CompleteOrder { CreditCard = "123-456-789" }; bus.Send("Samples.MessageBodyEncryption.Endpoint2", completeOrder); Console.WriteLine("Message sent. Press any key to exit"); Console.ReadLine(); } }
static void Main() { // To disable second level retries(SLR), uncomment the following line. SLR is enabled by default. //Configure.Features.Disable<NServiceBus.Features.SecondLevelRetries>(); Console.Title = "Samples.FaultTolerance.Server"; Configure.Serialization.Json(); Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.FaultTolerance.Server"); configure.DefaultBuilder(); configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus .Start(() => configure.ForInstallationOn <Windows>().Install()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.NHibernateCustomSagaFinder"); busConfiguration.UseSerialization <JsonSerializer>(); busConfiguration.EnableInstallers(); #region NHibernateSetup busConfiguration.UsePersistence <NHibernatePersistence>() .ConnectionString(@"Data Source=.\SqlExpress;Initial Catalog=NHCustomSagaFinder;Integrated Security=True"); #endregion using (IStartableBus bus = Bus.Create(busConfiguration)) { bus.Start(); bus.SendLocal(new StartOrder { OrderId = "123" }); Console.WriteLine("\r\nPress any key to stop program\r\n"); Console.ReadKey(); } }
static void Main() { BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.FaultTolerance.Client"); busConfiguration.UseSerialization <JsonSerializer>(); busConfiguration.EnableInstallers(); busConfiguration.UsePersistence <InMemoryPersistence>(); using (IStartableBus bus = Bus.Create(busConfiguration)) { bus.Start(); Console.WriteLine("Press 'Enter' to send a message.To exit, Ctrl + C"); while (Console.ReadLine() != null) { Guid id = Guid.NewGuid(); bus.Send("Samples.FaultTolerance.Server", new MyMessage { Id = id }); Console.WriteLine("Sent a new message with id: {0}", id.ToString("N")); } } }
static void Main() { #region ConfigureAppender MyConsoleAppender consoleAppender = new MyConsoleAppender { Color = ConsoleColor.Green }; BasicConfigurator.Configure(consoleAppender); LogManager.Use <Log4NetFactory>(); #endregion BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.Log4Net.Appender"); busConfiguration.UseSerialization <JsonSerializer>(); busConfiguration.EnableInstallers(); busConfiguration.UsePersistence <InMemoryPersistence>(); using (IStartableBus bus = Bus.Create(busConfiguration)) { bus.Start(); bus.SendLocal(new MyMessage()); Console.WriteLine("\r\nPress any key to stop program\r\n"); Console.ReadKey(); } }
static void Main() { Configure.Serialization.Json(); #pragma warning disable 618 Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Scaleout.Worker2"); configure.DefaultBuilder(); configure.EnlistWithDistributor(); #pragma warning restore 618 #region WorkerNameToUseWhileTestingCode //called after EnlistWithDistributor Address.InitializeLocalAddress("Samples.Scaleout.Worker2"); #endregion configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
protected void Application_Start() { Configure.Instance.DefineEndpointName("lhptlistener"); Configure.ScaleOut(s => s.UseUniqueBrokerQueuePerMachine()); Feature.Disable <TimeoutManager>(); Feature.Disable <SecondLevelRetries>(); Feature.Disable <AutoSubscribe>(); startableBus = Configure.With() .DefaultBuilder() .TraceLogger() .UseTransport <AzureServiceBus>() .PurgeOnStartup(true) .UnicastBus() .CreateBus(); Configure.Instance.ForInstallationOn <Windows>().Install(); bus = startableBus.Start(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
static void Main() { Console.Title = "Samples.Unobtrusive.Server"; Configure.Serialization.Json(); Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Unobtrusive.Server"); configure.DefaultBuilder(); configure.UseTransport <Msmq>(); configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.RijndaelEncryptionService(); configure.ApplyCustomConventions(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus .Start(() => configure.ForInstallationOn <Windows>().Install()); CommandSender.Start(bus); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.ComplexSagaFindingLogic"); configure.DefaultBuilder(); configure.Sagas(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new StartOrder { OrderId = "123" }); bus.SendLocal(new StartOrder { OrderId = "456" }); Console.WriteLine("\r\nPress any key to stop program\r\n"); Console.ReadKey(); } }
static void Main() { Console.Title = "Samples.MessageBodyEncryption.Endpoint1"; Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.MessageBodyEncryption.Endpoint1"); configure.DefaultBuilder(); configure.RijndaelEncryptionService(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); #region RegisterMessageEncryptor configure.RegisterMessageEncryptor(); #endregion using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); CompleteOrder completeOrder = new CompleteOrder { CreditCard = "123-456-789" }; bus.Send("Samples.MessageBodyEncryption.Endpoint2", completeOrder); Console.WriteLine("Message sent."); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { Configure.Serialization.Json(); #region ContainerConfiguration Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Ninject"); StandardKernel kernel = new StandardKernel(); kernel.Bind <MyService>().ToConstant(new MyService()); configure.NinjectBuilder(kernel); #endregion configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new MyMessage()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
protected void Application_Start() { Configure.ScaleOut(s => s.UseSingleBrokerQueue()); Feature.Disable <TimeoutManager>(); startableBus = Configure.With() .DefaultBuilder() .TraceLogger() .UseTransport <AzureServiceBus>() .PurgeOnStartup(true) .UnicastBus() .RunHandlersUnderIncomingPrincipal(false) .RijndaelEncryptionService() .CreateBus(); Configure.Instance.ForInstallationOn <Windows>().Install(); bus = startableBus.Start(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); }
static void Main() { Console.Title = "Samples.Spring"; Configure.Serialization.Json(); #region ContainerConfiguration Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Spring"); GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.ObjectFactory.RegisterSingleton("MyService", new MyService()); configure.SpringFrameworkBuilder(applicationContext); #endregion configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new MyMessage()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { Console.Title = "Samples.Unity"; #region ContainerConfiguration Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Unity"); UnityContainer container = new UnityContainer(); container.RegisterInstance(new MyService()); configure.UnityBuilder(container); #endregion configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new MyMessage()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { Console.Title = "Samples.UsernameHeader.Endpoint1"; Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.UsernameHeader.Endpoint1"); configure.DefaultBuilder(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); #region ComponentRegistartion configure.Configurer .ConfigureComponent <UsernameMutator>(DependencyLifecycle.InstancePerCall); #endregion using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); #region SendMessage Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("FakeUser"), new string[0]); bus.Send("Samples.UsernameHeader.Endpoint2", new MyMessage()); #endregion Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadKey(); } }
static void Main() { Configure.Serialization.Json(); #region ContainerConfiguration Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Castle"); WindsorContainer container = new WindsorContainer(); container.Register(Component.For <MyService>().Instance(new MyService())); configure.CastleWindsorBuilder(container); #endregion configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new MyMessage()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
static void Main() { BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.FullDuplex.Client"); busConfiguration.UseSerialization <JsonSerializer>(); busConfiguration.UsePersistence <InMemoryPersistence>(); busConfiguration.EnableInstallers(); using (IStartableBus bus = Bus.Create(busConfiguration)) { bus.Start(); Console.WriteLine("Press 'Enter' to send a message.To exit, Ctrl + C"); #region ClientLoop while (Console.ReadLine() != null) { Guid g = Guid.NewGuid(); Console.WriteLine("Requesting to get data by id: {0}", g.ToString("N")); RequestDataMessage message = new RequestDataMessage { DataId = g, String = "<node>it's my \"node\" & i like it<node>" }; bus.Send("Samples.FullDuplex.Server", message); } #endregion } }
private static IBus ConfigureNServiceBus() { var bus = _configure .Start(); return(bus); }
static void Main() { #region ConfigureLogging Configure configure = Configure.With(); configure.DefineEndpointName("Samples.Logging.Default"); //Configures a ConsoleAppender with a threshold of Debug configure.Log4Net(); #endregion configure.DefaultBuilder(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new MyMessage()); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
private void StartBus() { try { var myDocumentStore = new DocumentStore { ConnectionStringName = "EpiFlowDB" }; var busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("EpiFlow.Messages"); busConfiguration.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(_container)); busConfiguration.UseSerialization<JsonSerializer>(); busConfiguration.UsePersistence<RavenDBPersistence>() .UseDocumentStoreForSubscriptions(myDocumentStore) .UseDocumentStoreForSagas(myDocumentStore) .UseDocumentStoreForTimeouts(myDocumentStore); busConfiguration.UseTransport<RabbitMQTransport>(); busConfiguration.DefineCriticalErrorAction(OnCriticalError); busConfiguration.Transactions().DisableDistributedTransactions(); if (Environment.UserInteractive && Debugger.IsAttached) { busConfiguration.EnableInstallers(); } _bus = Bus.Create(busConfiguration); _bus.Start(); } catch (Exception exception) { OnCriticalError("Failed to start the bus.", exception); } }
static void Main() { Configure.Serialization.Json(); #region ContainerConfiguration Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Autofac"); ContainerBuilder builder = new ContainerBuilder(); builder.RegisterInstance(new MyService()); IContainer container = builder.Build(); configure.AutofacBuilder(container); #endregion configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); configure.UseTransport <Msmq>(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); bus.SendLocal(new MyMessage()); Console.WriteLine("\r\nPress any key to stop program\r\n"); Console.ReadKey(); } }
protected void Application_Start() { #region ApplicationStart ContainerBuilder builder = new ContainerBuilder(); // Register your MVC controllers. builder.RegisterControllers(typeof(MvcApplication).Assembly); // Set the dependency resolver to be Autofac. IContainer container = builder.Build(); DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.Mvc.WebApplication"); busConfiguration.UseSerialization <JsonSerializer>(); busConfiguration.UseContainer <AutofacBuilder>(c => c.ExistingLifetimeScope(container)); busConfiguration.UsePersistence <InMemoryPersistence>(); busConfiguration.EnableInstallers(); IStartableBus startableBus = Bus.Create(busConfiguration); bus = startableBus.Start(); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); #endregion }
public void TestMethod1() { //Use a single queue Configure.ScaleOut(s => s.UseSingleBrokerQueue()); _startableBus = Configure.With() .DefaultBuilder() .RijndaelEncryptionService() .UseTransport<Msmq>() .UnicastBus() .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); /** * State sent to Saga * ***/ SendCommand command = new SendCommand(); command.RequestId = new Guid("8b265223-dc9e-4789-a6df-69d19f644ad7"); command.state = MyMessages.MessageParts.StateCodes.SentMySaga; _bus = _startableBus.Start(); _bus.Send(command); }
static void Main() { LogManager.Use <DefaultFactory>() .Level(LogLevel.Warn); BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.ErrorHandling.WithSLR"); busConfiguration.UseSerialization <JsonSerializer>(); busConfiguration.UsePersistence <InMemoryPersistence>(); busConfiguration.EnableInstallers(); using (IStartableBus bus = Bus.Create(busConfiguration)) { bus.Start(); Console.WriteLine("Press any key to send a message that will throw an exception."); Console.WriteLine("To exit, press Ctrl + C"); while (true) { Console.ReadLine(); MyMessage m = new MyMessage { Id = Guid.NewGuid() }; bus.SendLocal(m); } } }
static void Main() { BusConfiguration busConfig = new BusConfiguration(); busConfig.EndpointName("Samples.Versioning.V2Publisher"); busConfig.UseSerialization <JsonSerializer>(); busConfig.UsePersistence <InMemoryPersistence>(); busConfig.UsePersistence <MsmqPersistence>() .For(Storage.Subscriptions); busConfig.EnableInstallers(); using (IStartableBus bus = Bus.Create(busConfig)) { bus.Start(); Console.WriteLine("Press 'Enter' to publish a message, Ctrl + C to exit."); while (Console.ReadLine() != null) { bus.Publish <V2.Messages.ISomethingHappened>(sh => { sh.SomeData = 1; sh.MoreInfo = "It's a secret."; }); Console.WriteLine("Published event."); } } }
static void Main() { #region self-hosting Configure configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.SelfHosting"); configure.DefaultBuilder(); configure.Sagas(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); using (IStartableBus startableBus = configure.UnicastBus().CreateBus()) { IBus bus = startableBus.Start(() => configure.ForInstallationOn <Windows>().Install()); Console.WriteLine("\r\nBus created and configured; press any key to stop program\r\n"); bus.SendLocal(new MyMessage()); Console.ReadKey(); } #endregion }
public bool Start(HostControl hostControl) { Log.Info("Starting bridge service..."); _bus = (IStartableBus) BusFactory.Create(); _bus.Start(); Log.Info("Bridge service started."); return true; }
private static void InitBus() { _startableBus = Configure.With() .DefaultBuilder() .UnicastBus() .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); _bus = _startableBus.Start(); }
public static void Bootstrap() { _startableBus = Configure.With() .DefineEndpointName("Plexis.Sample.WebService.Input") .Log4Net() .DefaultBuilder() .XmlSerializer("http://plexissample.com") .MsmqTransport() .UnicastBus() .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); _bus = _startableBus.Start(); }
protected void Application_Start() { Configure.ScaleOut(s => s.UseSingleBrokerQueue()); _startableBus = Configure.With() .DefaultBuilder() .UseTransport<Msmq>() .UnicastBus() .RunGateway() //this line configures the gateway .FileShareDataBus(".\\databus") .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); _bus = _startableBus.Start(); AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { Configure.ScaleOut(s => s.UseSingleBrokerQueue()); _startableBus = Configure.With() .DefaultBuilder() .RijndaelEncryptionService() .UseTransport<Msmq>() .UnicastBus() .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); _bus = _startableBus.Start(); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); _startableBus = Configure.With() .DefaultBuilder() .ForMvc() // no need for this... .MsmqTransport() .UnicastBus() .RunGateway() //this line configures the gateway .FileShareDataBus(".\\databus") .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); _bus = _startableBus.Start(); }
protected void Application_Start() { startableBus = Configure.With() .DefaultBuilder() .Log4Net(new DebugAppender {Threshold = Level.Warn}) .UseTransport<Msmq>() .PurgeOnStartup(true) .UnicastBus() .RunHandlersUnderIncomingPrincipal(false) .RijndaelEncryptionService() .UseNHibernateTimeoutPersister() .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); bus = startableBus.Start(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { var config = new BusConfiguration(); config.Conventions() .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Commands")) .DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("Events")) .DefiningMessagesAs(t => t.Namespace != null && t.Namespace.StartsWith("VideoStore") && t.Namespace.EndsWith("RequestResponse")) .DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted")); config.UseTransport<AzureStorageQueueTransport>(); config.UsePersistence<InMemoryPersistence>(); config.PurgeOnStartup(true); config.RijndaelEncryptionService(); config.EnableInstallers(); startableBus = NServiceBus.Bus.Create(config); bus = startableBus.Start(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); }
protected void Application_Start() { //NSB _startableBus = Configure.With() .StructureMapBuilder() .RavenPersistence("RavenDB") .UseTransport<ActiveMQ>() .DefineEndpointName("IS.Argus.Core.Web") .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith("Command")) .DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith("Event")) .DefiningMessagesAs(t => t.Namespace == "Messages") .UnicastBus() .CreateBus(); Configure.Instance.ForInstallationOn<Windows>().Install(); _bus = _startableBus.Start(); AreaRegistration.RegisterAllAreas(); DependencyResolver.SetResolver(new StructureMapDependencyResolver(ObjectFactory.Container)); // for MVC FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); GlobalHost.DependencyResolver = new StructureMapSignalRDependencyResolver(ObjectFactory.Container); // for signalR RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ObjectFactory.Container.Configure(x => { x.For<IControllerActivator>().Use<StructureMapControllerActivator>(); x.For<IFilterProvider>().Use<StructureMapFilterProvider>(); x.SetAllProperties(p => p.OfType<IAsyncDocumentSession>()); x.Scan(scan => { scan.LookForRegistries(); scan.Assembly("ProblemTest"); }); }); }
private static void Subscribe(IStartableBus bus, WaitHandle waitHandle) { try { bus.Start(); //Console.WriteLine("Waiting for messages."); waitHandle.WaitOne(); } catch (Exception ex) { Console.WriteLine("Unhandled ex: {0}", ex); } }
private static void StartBus(BusConfiguration busConfiguration) { bus = Bus.Create(busConfiguration); bus.Start(); }