예제 #1
0
 /// <summary>
 /// Stream queue balancer that uses Azure deployment information for load balancing.
 /// Requires silo running in Azure.
 /// This Balancer uses both the information about the full set of silos as reported by Azure role code but
 /// does NOT use the information from Membership oracle about currently alive silos.
 /// That is, it does not rebalance queues based on dynamic changes in the cluster Membership.
 /// </summary>
 public static void UseStaticAzureDeploymentBalancer(this ISiloPersistentStreamConfigurator configurator,
                                                     TimeSpan?siloMaturityPeriod = null)
 {
     configurator.ConfigurePartitionBalancing <DeploymentBasedQueueBalancerOptions>(
         (s, n) => DeploymentBasedQueueBalancer.Create(s, n, new ServiceRuntimeWrapper(s.GetService <ILoggerFactory>())),
         options => options.Configure(op =>
     {
         op.IsFixed = true;
         if (siloMaturityPeriod.HasValue)
         {
             op.SiloMaturityPeriod = siloMaturityPeriod.Value;
         }
     }));
 }
예제 #2
0
 public static void UseDynamicClusterConfigDeploymentBalancer(this ISiloPersistentStreamConfigurator configurator,
                                                              TimeSpan?siloMaturityPeriod = null)
 {
     configurator.ConfigurePartitionBalancing <DeploymentBasedQueueBalancerOptions>(
         (s, n) => DeploymentBasedQueueBalancer.Create(s, n, s.GetRequiredService <IOptions <StaticClusterDeploymentOptions> >().Value),
         options => options.Configure(op =>
     {
         op.IsFixed = false;
         if (siloMaturityPeriod.HasValue)
         {
             op.SiloMaturityPeriod = siloMaturityPeriod.Value;
         }
     }));
 }