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


C# BusConfiguration.AzureConfigurationSource方法代码示例

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


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

示例1: Application_Start

 protected void Application_Start()
 {
     var busConfiguration = new BusConfiguration();
     busConfiguration.AzureConfigurationSource();
     busConfiguration.UseTransport<AzureStorageQueueTransport>();
     busConfiguration.UsePersistence<AzureStoragePersistence>();
     IStartableBus startableBus = Bus.Create(busConfiguration);
     IBus bus = startableBus.Start();
 }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:9,代码来源:HostingAndConfiguration.cs

示例2: Start

        public void Start()
        {
            DynamicHostControllerConfig configSection = null;

            var o = new BusConfiguration();
            o.AssembliesToScan(GetType().Assembly);
            o.AzureConfigurationSource();
            o.RegisterComponents(Configurer =>
            {
                Configurer.ConfigureComponent<DynamicEndpointLoader>(DependencyLifecycle.SingleInstance);
                Configurer.ConfigureComponent<DynamicEndpointProvisioner>(DependencyLifecycle.SingleInstance);
                Configurer.ConfigureComponent<DynamicEndpointRunner>(DependencyLifecycle.SingleInstance);
                Configurer.ConfigureComponent<DynamicHostMonitor>(DependencyLifecycle.SingleInstance);

                configSection = o.GetSettings().GetConfigSection<DynamicHostControllerConfig>() ?? new DynamicHostControllerConfig();

                Configurer.ConfigureProperty<DynamicEndpointLoader>(t => t.ConnectionString, configSection.ConnectionString);
                Configurer.ConfigureProperty<DynamicEndpointLoader>(t => t.Container, configSection.Container);
                Configurer.ConfigureProperty<DynamicEndpointProvisioner>(t => t.LocalResource, configSection.LocalResource);
                Configurer.ConfigureProperty<DynamicEndpointProvisioner>(t => t.RecycleRoleOnError, configSection.RecycleRoleOnError);
                Configurer.ConfigureProperty<DynamicEndpointRunner>(t => t.RecycleRoleOnError, configSection.RecycleRoleOnError);
                Configurer.ConfigureProperty<DynamicEndpointRunner>(t => t.TimeToWaitUntilProcessIsKilled, configSection.TimeToWaitUntilProcessIsKilled);
                Configurer.ConfigureProperty<DynamicHostMonitor>(t => t.Interval, configSection.UpdateInterval);
            });

            o.UsePersistence<AzureStoragePersistence>();
            o.DiscardFailedMessagesInsteadOfSendingToErrorQueue();

            profileManager.ActivateProfileHandlers(o);
            specifier.Customize(o);

            var bus = (UnicastBus)Bus.CreateSendOnly(o);

            loader = bus.Builder.Build<DynamicEndpointLoader>();
            provisioner = bus.Builder.Build<DynamicEndpointProvisioner>();
            runner = bus.Builder.Build<DynamicEndpointRunner>();

            var endpointsToHost = loader.LoadEndpoints();
            if (endpointsToHost == null) return;

            runningServices = new List<EndpointToHost>(endpointsToHost);

            provisioner.Provision(runningServices);

            runner.Start(runningServices);

            if (!configSection.AutoUpdate) return;

            monitor = bus.Builder.Build<DynamicHostMonitor>();
            monitor.UpdatedEndpoints += UpdatedEndpoints;
            monitor.NewEndpoints += NewEndpoints;
            monitor.RemovedEndpoints += RemovedEndpoints;
            monitor.Monitor(runningServices);
            monitor.Start();
        }
开发者ID:mjhilton,项目名称:NServiceBus.Host.AzureCloudService,代码行数:55,代码来源:DynamicHostController.cs

示例3: Customize

        public void Customize(BusConfiguration configuration)
        {
            configuration.UseTransport<AzureServiceBusTransport>().ConnectionString(ConnectionString);

            configuration.Transactions()
                .DisableDistributedTransactions()
                .DoNotWrapHandlersExecutionInATransactionScope();

            configuration.AzureConfigurationSource();

            configuration.UsePersistence<InMemoryPersistence>();
        }
开发者ID:BobAtParticular,项目名称:NSB.ASB.Issue39,代码行数:12,代码来源:EndpointConfiguration.cs

示例4: PerformConfiguration

        void PerformConfiguration(Action<BusConfiguration> moreConfiguration = null)
        {
            var loggingConfigurers = profileManager.GetLoggingConfigurer();
            foreach (var loggingConfigurer in loggingConfigurers)
            {
                loggingConfigurer.Configure(specifier);
            }

            var configuration = new BusConfiguration();

            configuration.EndpointName(endpointNameToUse);
            configuration.AssembliesToScan(assembliesToScan);
           
            if (SafeRoleEnvironment.IsAvailable)
            {
                if (!IsHostedIn.ChildHostProcess())
                {
                    configuration.AzureConfigurationSource();
                }

                var host = SafeRoleEnvironment.CurrentRoleName;
                var instance = SafeRoleEnvironment.CurrentRoleInstanceId;
                var hostId = DeterministicGuid(instance, host);
                configuration
                    .UniquelyIdentifyRunningInstance()
                    .UsingCustomIdentifier(hostId)
                    .UsingNames(instance, host);
            }

            if (moreConfiguration != null)
                {
                    moreConfiguration(configuration);
                }

            specifier.Customize(configuration);
            RoleManager.TweakConfigurationBuilder(specifier, configuration);
            bus = (UnicastBus) Bus.Create(configuration);
        }
开发者ID:mjhilton,项目名称:NServiceBus.Azure,代码行数:38,代码来源:GenericHost.cs


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