public WindowsAzureInfrastructureCoordinatorFactory(
            IConfigStore configStore,
            string configSectionName,
            Guid partitionId,
            long replicaId,
            IInfrastructureAgentWrapper agent,
            IAzureModeDetector modeDetector)
        {
            configStore.ThrowIfNull("configStore");
            configSectionName.ThrowIfNullOrWhiteSpace("configSectionName");
            agent.ThrowIfNull("agent");

            this.configStore       = configStore;
            this.configSectionName = configSectionName;
            this.agent             = agent;
            this.partitionId       = partitionId;
            this.replicaId         = replicaId;
            this.modeDetector      = modeDetector;
        }
示例#2
0
        /// <summary>
        /// Detects the mode by checking if the parallel endpoint is publishing
        /// job information. If so, creates the parallel coordinator. If not, creates
        /// the serial coordinator but passes it a reference to the autodetector, so
        /// that the serial coordinator can exit when it detects that parallel mode has
        /// been enabled via a tenant update. That update would be invisible over the
        /// serial channel, so this is the only way the serial coordinator can detect a change.
        /// </summary>
        IInfrastructureCoordinator CreateCoordinatorAzureAutodetect(CoordinatorFactoryArgs args)
        {
            var azureParallelFactory = InternalCreateCoordinatorFactoryAzureParallel(args);

            IAzureModeDetector modeDetector = ((IAzureModeDetectorFactory)azureParallelFactory).CreateAzureModeDetector();

            AzureMode mode = modeDetector.DetectModeAsync().GetAwaiter().GetResult();

            TraceType.WriteInfo("Auto-detected Azure mode: {0}", mode);

            switch (mode)
            {
            case AzureMode.Serial:
                return(InternalCreateCoordinatorAzureSerial(args, modeDetector));

            case AzureMode.Parallel:
                return(azureParallelFactory.Create());

            default:
                throw new InvalidOperationException("Failed to auto-detect Azure coordinator mode");
            }
        }
示例#3
0
 IInfrastructureCoordinator InternalCreateCoordinatorAzureSerial(CoordinatorFactoryArgs args, IAzureModeDetector modeDetector)
 {
     return(CreateCoordinatorByReflection(
                SerialAssemblyName,
                SerialCoordinatorFactoryTypeName,
                this.configStore, args.ConfigSectionName, args.PartitionId, args.ReplicaId, args.Agent, modeDetector));
 }