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


C# EndpointConfiguration.ScaleOut方法代码示例

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


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

示例1: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.WcfCallbacks.Endpoint";
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.WcfCallbacks.Endpoint");
        endpointConfiguration.ScaleOut()
            .InstanceDiscriminator("1");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        #region startbus

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            using (StartWcfHost(endpoint))
            {
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
            }
        }
        finally
        {
            await endpoint.Stop();
        }

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

示例2: IndividualizeQueues

        IndividualizeQueues(EndpointConfiguration endpointConfiguration)
        {
            #region UniqueQueuePerEndpointInstanceDiscriminator

            endpointConfiguration.ScaleOut()
                .InstanceDiscriminator("MyInstanceID");

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

示例3: StartBus

    async Task StartBus()
    {
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Callbacks.WebSender");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.ScaleOut()
            .InstanceDiscriminator("1");

        Endpoint = await NServiceBus.Endpoint.Start(endpointConfiguration);
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:12,代码来源:Global.asax.cs

示例4: AsyncMain

 static async Task AsyncMain()
 {
     EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
     endpointConfiguration.EndpointName("Server");
     string discriminator = ConfigurationManager.AppSettings["InstanceId"];
     endpointConfiguration.ScaleOut().InstanceDiscriminator(discriminator);
     endpointConfiguration.UsePersistence<InMemoryPersistence>();
     endpointConfiguration.SendFailedMessagesTo("error");
     IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
     Console.WriteLine("Press enter to exit.");
     Console.ReadLine();
     await endpoint.Stop();
 }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:13,代码来源:Program.cs

示例5: Simple

        async Task Simple(EndpointConfiguration endpointConfiguration, IEndpointInstance endpoint, SendOptions sendOptions)
        {
            #region 5to6-Callbacks-InstanceId
            endpointConfiguration.ScaleOut().InstanceDiscriminator("uniqueId");
            #endregion

            #region 5to6-Callbacks

            RequestMessage message = new RequestMessage();
            ResponseMessage response = await endpoint.Request<ResponseMessage>(message, sendOptions);

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

示例6: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.Callbacks.Sender";
        var endpointConfiguration = new EndpointConfiguration("Samples.Callbacks.Sender");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.ScaleOut()
            .InstanceDiscriminator("1");
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");
        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            Console.WriteLine("Press 'E' to send a message with an enum return");
            Console.WriteLine("Press 'I' to send a message with an int return");
            Console.WriteLine("Press 'O' to send a message with an object return");
            Console.WriteLine("Press any other key to exit");

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

                if (key.Key == ConsoleKey.E)
                {
                    await SendEnumMessage(endpointInstance)
                        .ConfigureAwait(false);
                    continue;
                }
                if (key.Key == ConsoleKey.I)
                {
                    await SendIntMessage(endpointInstance)
                        .ConfigureAwait(false);
                    continue;
                }
                if (key.Key == ConsoleKey.O)
                {
                    await SendObjectMessage(endpointInstance)
                        .ConfigureAwait(false);
                    continue;
                }
                return;
            }
        }
        finally
        {
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:51,代码来源:Program.cs

示例7: Application_Start

    protected void Application_Start(object sender, EventArgs e)
    {
        #region ApplicationStart

        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.AsyncPages.WebApplication");
        endpointConfiguration.ScaleOut()
            .InstanceDiscriminator("1");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();

        Endpoint = NServiceBus.Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();

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

示例8: Simple

        async void Simple(EndpointConfiguration endpointConfiguration, IEndpointInstance endpoint, SendOptions sendOptions, ILog log)
        {
            #region Callbacks-InstanceId

            endpointConfiguration.ScaleOut().InstanceDiscriminator("uniqueId");

            #endregion

            #region ObjectCallback

            Message message = new Message();
            ResponseMessage response = await endpoint.Request<ResponseMessage>(message, sendOptions);
            log.Info("Callback received with response:" + response.Property);

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

示例9: AsyncMain

 static async Task AsyncMain()
 {
     Console.Title = "Samples.CustomDistributionStrategy.Server2";
     var endpointConfiguration = new EndpointConfiguration("Samples.CustomDistributionStrategy.Server");
     var discriminator = ConfigurationManager.AppSettings["InstanceId"];
     var scaleOut = endpointConfiguration.ScaleOut();
     scaleOut.InstanceDiscriminator(discriminator);
     endpointConfiguration.UsePersistence<InMemoryPersistence>();
     endpointConfiguration.SendFailedMessagesTo("error");
     var endpointInstance = await Endpoint.Start(endpointConfiguration)
         .ConfigureAwait(false);
     Console.WriteLine("Press enter to exit.");
     Console.ReadLine();
     await endpointInstance.Stop()
         .ConfigureAwait(false);
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:16,代码来源:Program.cs

示例10: Main

    static void Main()
    {
        Console.Title = "Samples.Scaleout.Worker1";
        #region Workerstartup
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Scaleout.Worker");
        string discriminator = ConfigurationManager.AppSettings["InstanceId"];
        endpointConfiguration.ScaleOut().InstanceDiscriminator(discriminator);
        string masterNodeAddress = ConfigurationManager.AppSettings["MasterNodeAddress"];
        string masterNodeControlAddress = ConfigurationManager.AppSettings["MasterNodeControlAddress"];
        endpointConfiguration.EnlistWithLegacyMSMQDistributor(masterNodeAddress, masterNodeControlAddress, 10);
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();

        Run(endpointConfiguration).GetAwaiter().GetResult();
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:17,代码来源:Program.cs

示例11: Main

    static void Main()
    {
        var endpointConfiguration = new EndpointConfiguration("Samples.Scaleout.Worker");
        endpointConfiguration.ScaleOut()
            .InstanceDiscriminator(ConfigurationManager.AppSettings["InstanceId"]);
        endpointConfiguration
            .EnlistWithLegacyMSMQDistributor(
            ConfigurationManager.AppSettings["DistributorAddress"],
            ConfigurationManager.AppSettings["DistributorControlAddress"],
            10);
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.Conventions()
            .DefiningMessagesAs(t => t.GetInterfaces().Contains(typeof(IMessage)));

        Run(endpointConfiguration).GetAwaiter().GetResult();
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:19,代码来源:Program.cs

示例12: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.AsyncPages.Server";
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.AsyncPages.Server");
        endpointConfiguration.ScaleOut()
            .InstanceDiscriminator("1");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();

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

示例13: 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();

        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Mvc.WebApplication");
        endpointConfiguration.ScaleOut()
            .InstanceDiscriminator("1");
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();

        endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();

        ContainerBuilder updater = new ContainerBuilder();
        updater.RegisterInstance(endpoint);
        updater.Update(container);

        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

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

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


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