本文整理汇总了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();
}
示例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();
}
示例3: Customize
public void Customize(BusConfiguration configuration)
{
configuration.UseTransport<AzureServiceBusTransport>().ConnectionString(ConnectionString);
configuration.Transactions()
.DisableDistributedTransactions()
.DoNotWrapHandlersExecutionInATransactionScope();
configuration.AzureConfigurationSource();
configuration.UsePersistence<InMemoryPersistence>();
}
示例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);
}