protected ReplicaSelector GetReplicaSelector()
 {
     return(ReplicaSelectorOperationBase.GetReplicaSelector(
                this.ParameterSetName,
                this.PartitionId,
                this.ServiceName,
                this.PartitionKey,
                this.ReplicaOrInstanceId));
 }
예제 #2
0
        protected override void ProcessRecord()
        {
            var clusterConnection = this.GetClusterConnection();

            try
            {
                if (this.ParameterSetName == "ByNodeName")
                {
                    this.InvokeCommandAsync(
                        clusterConnection,
                        this.NodeName,
                        this.PartitionId,
                        this.ReplicaOrInstanceId.GetValueOrDefault(),
                        this.CommandCompletionMode ?? CompletionMode.DoNotVerify,
                        this.GetTimeout(),
                        this.GetCancellationToken()).Wait();
                    this.WriteObject(string.Format(
                                         CultureInfo.CurrentCulture,
                                         StringResources.Info_ReplicaControlOperationSucceeded,
                                         this.GetOperationNameForSuccessTrace(),
                                         "scheduled",
                                         this.NodeName,
                                         this.ReplicaOrInstanceId,
                                         this.PartitionId));
                }
                else
                {
                    var replicaSelector = ReplicaSelectorOperationBase.GetReplicaSelector(
                        this.ParameterSetName,
                        this.PartitionId,
                        this.ServiceName,
                        this.PartitionKey,
                        this.ReplicaOrInstanceId);
                    var returnResult = this.InvokeCommandAsync(
                        clusterConnection,
                        replicaSelector,
                        this.CommandCompletionMode ?? CompletionMode.Verify,
                        this.GetCancellationToken()).Result;
                    this.WriteObject(this.FormatOutput(returnResult));
                }
            }
            catch (AggregateException aggregateException)
            {
                aggregateException.Handle((ae) =>
                {
                    this.ThrowTerminatingError(
                        ae,
                        Constants.ReportFaultCommandErrorId,
                        clusterConnection);
                    return(true);
                });
            }
        }