当前位置: 首页>>代码示例>>C#>>正文


C# BusConfiguration.EnableInstallers方法代码示例

本文整理汇总了C#中BusConfiguration.EnableInstallers方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.EnableInstallers方法的具体用法?C# BusConfiguration.EnableInstallers怎么用?C# BusConfiguration.EnableInstallers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BusConfiguration的用法示例。


在下文中一共展示了BusConfiguration.EnableInstallers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsyncMain

    static async Task AsyncMain()
    {
        #region logging
        DefaultFactory defaultFactory = LogManager.Use<DefaultFactory>();
        defaultFactory.Level(LogLevel.Fatal);
        #endregion
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Logging.Default");
        busConfiguration.SendFailedMessagesTo("error");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            await endpoint.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:25,代码来源:Program.cs

示例2: Main

    static void Main()
    {
        Console.Title = "Samples.MongoDB.Client";
        var busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.MongoDB.Client");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

        using (var bus = Bus.Create(busConfiguration).Start())
        {
            Console.WriteLine("Press 'enter' to send a StartOrder messages");
            Console.WriteLine("Press any other key to exit");

            while (true)
            {
                var key = Console.ReadKey();
                Console.WriteLine();

                if (key.Key != ConsoleKey.Enter)
                {
                    return;
                }

                var orderId = Guid.NewGuid();
                var startOrder = new StartOrder
                {
                    OrderId = orderId
                };
                bus.Send("Samples.MongoDB.Server", startOrder);
                Console.WriteLine($"StartOrder Message sent with OrderId {orderId}");
            }
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:34,代码来源:Program.cs

示例3: Application_Start

    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();

        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.MvcInjection.WebApplication");
        // ExistingLifetimeScope() ensures that IBus is added to the container as well,
        // allowing you to resolve IBus from your own components.
        busConfiguration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();

        bus = Bus.CreateSendOnly(busConfiguration);

        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

        AreaRegistration.RegisterAllAreas();
        RegisterRoutes(RouteTable.Routes);

        #endregion
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:30,代码来源:Global.asax.cs

示例4: AsyncMain

    static async Task AsyncMain()
    {
        #region ContainerConfiguration
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Unity");

        UnityContainer container = new UnityContainer();
        container.RegisterInstance(new MyService());
        busConfiguration.UseContainer<UnityBuilder>(c => c.UseExistingContainer(container));
        #endregion
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();
        busConfiguration.SendFailedMessagesTo("error");

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            IBusSession busSession = endpoint.CreateBusSession();
            await busSession.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:28,代码来源:Program.cs

示例5: OnStart

        protected override void OnStart(string[] args)
        {
            try
            {
                container = new Container(x => x.AddRegistry<DependencyRegistry>());
                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();
                }
                var startableBus = Bus.Create(busConfiguration);
                bus = startableBus.Start();
            }
            catch (Exception exception)
            {
                OnCriticalError("Failed to start the bus.", exception);
            }
        }
开发者ID:wettsten,项目名称:EpiFlow,代码行数:31,代码来源:ProgramService.cs

示例6: AsyncMain

    static async Task AsyncMain()
    {
        #region ContainerConfiguration

        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Castle");

        WindsorContainer container = new WindsorContainer();
        container.Register(Component.For<MyService>().Instance(new MyService()));

        busConfiguration.UseContainer<WindsorBuilder>(c => c.ExistingContainer(container));

        #endregion

        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.SendFailedMessagesTo("error");
        busConfiguration.EnableInstallers();

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            await endpoint.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:31,代码来源:Program.cs

示例7: Main

    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.EnableFeature<MyFeature>();
        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();
    }
开发者ID:eclaus,项目名称:docs.particular.net,代码行数:28,代码来源:Program.cs

示例8: Init

        public static void Init()
        {
            if (Bus != null)
            return;

              lock (SyncLock)
              {
            if (Bus != null)
              return;
            var cfg = new BusConfiguration();

            cfg.EndpointName(MethodBase.GetCurrentMethod().DeclaringType.Namespace);
            cfg.UseTransport<MsmqTransport>();
            cfg.UsePersistence<InMemoryPersistence>();
            cfg.EnableInstallers();
            cfg.UseSerialization<JsonSerializer>();

            cfg.Conventions()
               .DefiningMessagesAs(t => t.Namespace != null && t.Namespace.EndsWith(".Messages"))
               .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith(".Commands"))
               .DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith(".Events"));

            Bus = NServiceBus.Bus.Create(cfg).Start();
              }
        }
开发者ID:rioka,项目名称:NsbServiceHostBasedGateway,代码行数:25,代码来源:ServiceBus.cs

示例9: Main

    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.FullDuplex.Client");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();

        using (IBus bus = Bus.Create(busConfiguration).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
        }
    }
开发者ID:ryanrdl,项目名称:docs.particular.net,代码行数:30,代码来源:Program.cs

示例10: AsyncOnStart

 async Task AsyncOnStart()
 {
     BusConfiguration busConfiguration = new BusConfiguration();
     //other bus configuration. endpoint name, logging, transport, persistence etc
     busConfiguration.EnableInstallers();
     endpointInstance = await Endpoint.Start(busConfiguration);
 }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:7,代码来源:ProgramService.cs

示例11: Main

    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.FaultTolerance.Client");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

        using (IBus bus = Bus.Create(busConfiguration).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"));
            }

        }
    }
开发者ID:ryanrdl,项目名称:docs.particular.net,代码行数:26,代码来源:Program.cs

示例12: Main

    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.StepByStep.Server");
        busConfiguration.UseSerialization<JsonSerializer>();
        /*
         * JSON
         * XML
         * Binary
         */

        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

        /*
         * InMemory
         * MSMQ
         * RavenDB
         * NHibernate
         * Azure Storage
         */
        using (IBus bus = Bus.Create(busConfiguration).Start())
        {
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
开发者ID:karol1990,项目名称:NServiceBus,代码行数:27,代码来源:Program.cs

示例13: Host

        public static void Host(TextWriter log, CancellationToken cancellationToken)
        {
            var configuration = new BusConfiguration();
            configuration.UseTransport<AzureStorageQueueTransport>();
            configuration.UsePersistence<InMemoryPersistence>();
            configuration.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"));
            configuration.RijndaelEncryptionService();
            configuration.EnableInstallers();
            
            var startableBus = Bus.Create(configuration);
            startableBus.Start();
            log.WriteLine("The VideoStore.Sales endpoint is now started and ready to accept messages");

            while (!cancellationToken.IsCancellationRequested)
            {
                Thread.Sleep(3000);
            }

            startableBus.Dispose();
            log.WriteLine("Host: stopped at " + DateTime.UtcNow);
        }
开发者ID:nigelhamer,项目名称:VideoStore.DistributedAppDemo,代码行数:25,代码来源:Functions.cs

示例14: AsyncMain

    static async Task AsyncMain()
    {
        #region ConfigureLogging
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Logging.Default");
        //Note that no config is required in version 5 and higher since logging is enabled by default
        #endregion
        busConfiguration.SendFailedMessagesTo("error");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            IBusSession busSession = endpoint.CreateBusSession();
            await busSession.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:25,代码来源:Program.cs

示例15: AsyncMain

    static async Task AsyncMain()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.WcfCallbacks");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.EnableInstallers();
        busConfiguration.SendFailedMessagesTo("error");

        #region startbus


        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            IBusSession busSession = endpoint.CreateBusSession();

            using (StartWcfHost(busSession))
            {
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
            }
        }
        finally
        {
            await endpoint.Stop();
        }

        #endregion
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:30,代码来源:Program.cs


注:本文中的BusConfiguration.EnableInstallers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。