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


C# BusConfiguration.ScaleOut方法代码示例

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


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

示例1: Usage

        public Usage()
        {
            #region ScaleOut

            BusConfiguration busConfiguration = new BusConfiguration();

            busConfiguration.ScaleOut().UseSingleBrokerQueue();
            //or
            busConfiguration.ScaleOut().UseUniqueBrokerQueuePerMachine();

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

示例2: Simple

    public void Simple()
    {
        #region ScaleOutV5

        var configuration = new BusConfiguration();

        configuration.ScaleOut().UseSingleBrokerQueue();
        //or
        configuration.ScaleOut().UseUniqueBrokerQueuePerMachine();

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

示例3: Main

    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();

        busConfiguration.EndpointName("Samples.ASB.Polymorphic.Subscriber");
        busConfiguration.ScaleOut().UseSingleBrokerQueue();
        busConfiguration.UseTransport<AzureServiceBusTransport>()
            .ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));

        #region DisableAutoSubscripton

        busConfiguration.DisableFeature<AutoSubscribe>();

        #endregion


        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.DisableFeature<SecondLevelRetries>();


        using (IBus bus = Bus.Create(busConfiguration).Start())
        {
            #region ControledSubscriptions

            bus.Subscribe<BaseEvent>();

            #endregion

            Console.WriteLine("Subscriber is ready to receive events");
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:35,代码来源:Program.cs

示例4: Main

        private static void Main()
        {
            var configuration = new BusConfiguration();

            configuration.EndpointName("Samples.ASB.NativeIntegration");
            configuration.ScaleOut().UseSingleBrokerQueue();
            configuration.EnableInstallers();
            configuration.UsePersistence<InMemoryPersistence>();
            configuration.UseSerialization<JsonSerializer>();

            BrokeredMessageBodyConversion.ExtractBody = brokeredMessage =>
            {
                using (var stream = new MemoryStream())
                using (var body = brokeredMessage.GetBody<Stream>())
                {
                    body.CopyTo(stream);
                    return stream.ToArray();
                }
            };

            configuration.UseTransport<AzureServiceBusTransport>()
                .ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));

            using (IBus bus = Bus.Create(configuration).Start())
            {
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
            }
        }
开发者ID:SeanFeldman,项目名称:NSB.ASB.NativeSender,代码行数:29,代码来源:Program.cs

示例5: Simple

        public void Simple()
        {
            BusConfiguration busConfiguration = new BusConfiguration();

            #region UniqueQueuePerEndpointInstance 5.2

            busConfiguration.ScaleOut()
                .UniqueQueuePerEndpointInstance();

            #endregion

            #region UniqueQueuePerEndpointInstanceWithSuffix 5.2

            busConfiguration.ScaleOut()
                .UniqueQueuePerEndpointInstance("-MyCustomSuffix");

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

示例6: UniqueQueuePerEndpointInstanceWithSuffix

        void UniqueQueuePerEndpointInstanceWithSuffix(BusConfiguration busConfiguration)
        {
            #region UniqueQueuePerEndpointInstanceWithSuffix 5.2

            var scaleOutSettings = busConfiguration.ScaleOut();
            scaleOutSettings.UniqueQueuePerEndpointInstance("-MyCustomSuffix");

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

示例7: UniqueQueuePerEndpointInstance

        void UniqueQueuePerEndpointInstance(BusConfiguration busConfiguration)
        {
            #region UniqueQueuePerEndpointInstance 5.2

            var scaleOutSettings = busConfiguration.ScaleOut();
            scaleOutSettings.UniqueQueuePerEndpointInstance();

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

示例8: Main

    static void Main()
    {
        Console.Title = "Samples.ASB.Polymorphic.Publisher";
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.ASB.Polymorphic.Publisher");
        busConfiguration.ScaleOut().UseSingleBrokerQueue();
        busConfiguration.UseTransport<AzureServiceBusTransport>()
            .ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.DisableFeature<SecondLevelRetries>();

        using (IBus bus = Bus.Create(busConfiguration).Start())
        {
            Console.WriteLine("Press '1' to publish the base event");
            Console.WriteLine("Press '2' to publish the derived event");
            Console.WriteLine("Press any other key to exit");

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

                Guid eventId = Guid.NewGuid();

                switch (key.Key)
                {
                    case ConsoleKey.D1:
                        bus.Publish<BaseEvent>(e =>
                        {
                            e.EventId = eventId;
                        });
                        Console.WriteLine("BaseEvent sent. EventId: " + eventId);
                        break;

                    case ConsoleKey.D2:
                        bus.Publish<DerivedEvent>(e =>
                        {
                            e.EventId = eventId;
                            e.Data = "more data";
                        });
                        Console.WriteLine("DerivedEvent sent. EventId: " + eventId);
                        break;

                    default:
                        return;
                }
            }
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:51,代码来源:Program.cs

示例9: ConfigureBus

        /// <summary>
        /// Configures the NServiceBus send only bus and registers it with the 
        ///     container
        /// </summary>
        public static ISendOnlyBus ConfigureBus(IUnityContainer container)
        {
            var busConfiguration = new BusConfiguration();
            busConfiguration.EndpointName("Tester.Sender");
            busConfiguration.UseSerialization<JsonSerializer>();
            busConfiguration.EnableInstallers();
            busConfiguration.UseTransport<AzureServiceBusTransport>().ConnectionString(ConnectionStrings.AzureServiceBus);
            busConfiguration.UsePersistence<InMemoryPersistence>();

            busConfiguration.ScaleOut().UseSingleBrokerQueue();
            busConfiguration.UseContainer<UnityBuilder>(c => c.UseExistingContainer(UnityConfig.GetConfiguredContainer()));
            busConfiguration.Conventions().DefiningEventsAs(x => x.Namespace != null && x.Namespace.StartsWith("Tester.Contracts.Events"));
            return Bus.CreateSendOnly(busConfiguration);
        }
开发者ID:SeanFeldman,项目名称:NSB.ASB.PolymorphicEvents,代码行数:18,代码来源:NServiceBusConfig.cs

示例10: StartBus

        static void StartBus()
        {
            var config = new BusConfiguration();
            config.EndpointName(EndpointName);
            config.ScaleOut().UseSingleBrokerQueue();

            config.UseTransport<AzureServiceBusTransport>()
                .ConnectionString(settings.GetConnectionString())
                .BrokeredMessageBodyInterceptors(m => m.ToBytes(), b => b.ToBrokeredMessage());

            config.UseSerialization<JsonSerializer>();
            config.UsePersistence<InMemoryPersistence>();

            Bus.Create(config).Start();
        }
开发者ID:kevinhillinger,项目名称:NServiceBus.AzureServiceBus.Serialization.Interop,代码行数:15,代码来源:Program.cs

示例11: CreateAmbientTxConfiguration

        public static BusConfiguration CreateAmbientTxConfiguration()
        {
            BusConfiguration busConfiguration = new BusConfiguration();
            busConfiguration.EnableInstallers();
            busConfiguration.ScaleOut().UseSingleBrokerQueue();

            busConfiguration.EndpointName("Receiver");
            busConfiguration.UseSerialization<JsonSerializer>();

            busConfiguration.DisableFeature<SecondLevelRetries>();

            Console.WriteLine("Default Configuration");

            return busConfiguration;
        }
开发者ID:nigelhamer,项目名称:NSB-Experiments,代码行数:15,代码来源:EndpointConfig.cs

示例12: Create

        public static IBus Create()
        {
            var config = new BusConfiguration();

            config.ScaleOut().UseSingleBrokerQueue();
            config.Transactions().EnableDistributedTransactions();
            config.UseTransport<SqlServerTransport>();
            config.UsePersistence<NHibernatePersistence, StorageType.Sagas>();
            config.UsePersistence<NHibernatePersistence, StorageType.Subscriptions>();
            config.UsePersistence<NHibernatePersistence, StorageType.Timeouts>();
            config.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
            config.PurgeOnStartup(false);
            config.EnableInstallers();

            return Bus.Create(config);
        }
开发者ID:ZlobnyiSerg,项目名称:logus-integration,代码行数:16,代码来源:BusFactory.cs

示例13: Main

    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();
        busConfiguration.EndpointName("Samples.Azure.ServiceBus.Endpoint2");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.ScaleOut().UseSingleBrokerQueue();
        busConfiguration.UseTransport<AzureServiceBusTransport>()
            .ConnectionString(Environment.GetEnvironmentVariable("SamplesAzureServiceBusConnection"));
        busConfiguration.UsePersistence<InMemoryPersistence>();

        using (IBus bus = Bus.Create(busConfiguration).Start())
        {
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:17,代码来源:Program.cs

示例14: GetBusConfiguration

        public static BusConfiguration GetBusConfiguration()
        {
            var busConfiguration = new BusConfiguration();
            busConfiguration.UseTransport<RabbitMQTransport>()
                .DisableCallbackReceiver()
                .CustomMessageIdStrategy(m => Guid.NewGuid().ToString())
                .ConnectionString("host=localhost");

            busConfiguration.UsePersistence<InMemoryPersistence>();
            busConfiguration.Conventions()
                .DefiningMessagesAs(t =>
                    t.Name.Equals("JObject", StringComparison.InvariantCultureIgnoreCase) ||
                    t.Name.Equals("SayHello", StringComparison.InvariantCultureIgnoreCase));
            busConfiguration.UseSerialization<JsonSerializer>();
            busConfiguration.ScaleOut().UseSingleBrokerQueue();
            return busConfiguration;
        }
开发者ID:fhalim,项目名称:TestingNSBSerialization,代码行数:17,代码来源:BusConventions.cs

示例15: AsyncMain

        static async Task AsyncMain()
        {
            var configuration = new BusConfiguration();
            configuration.EndpointName("Minion");
            configuration.ScaleOut().UniqueQueuePerEndpointInstance(ConfigurationManager.AppSettings["minion.name"]);
            configuration.UseSerialization<JsonSerializer>();
            configuration.UsePersistence<InMemoryPersistence>();
            configuration.EnableInstallers();
            configuration.SendFailedMessagesTo("error");

            var endpoint = await Endpoint.Start(configuration);

            ColouredConsole.WriteLine("Bello!");
            Console.WriteLine("Press any key to exit");

            Console.ReadLine();
            await endpoint.Stop();

        }
开发者ID:SeanFeldman,项目名称:DeathToTheDistributor,代码行数:19,代码来源:Program.cs


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