Example #1
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (this.TenantId != null)
     {
         base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId);
         this.server = GetDarTask.ResolveServerId(base.CurrentOrganizationId);
     }
 }
Example #2
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (this.TenantId != null)
     {
         base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId);
         this.server = GetDarTask.ResolveServerId(base.CurrentOrganizationId);
     }
     this.DataObject.ScopeId         = base.CurrentOrganizationId.GetBytes(Encoding.UTF8);
     this.DataObject.TaskType        = this.TaskType;
     this.DataObject.MaxRunningTasks = this.MaxRunningTasks;
     this.DataObject.Enabled         = this.IsEnabled;
 }
Example #3
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (this.TenantId != null)
     {
         base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId);
         this.server = GetDarTask.ResolveServerId(base.CurrentOrganizationId);
     }
     this.DataObject.Id                 = Guid.NewGuid().ToString();
     this.DataObject.TenantId           = base.CurrentOrganizationId.GetBytes(Encoding.UTF8);
     this.DataObject.TaskType           = this.TaskType;
     this.DataObject.Priority           = this.Priority;
     this.DataObject.SerializedTaskData = this.SerializedData;
 }
Example #4
0
        protected override void InternalProcessRecord()
        {
            base.WriteObject("Sending no op task");
            OrganizationId organizationId = (this.TenantId != null) ? GetDarTask.ResolveOrganizationId(this.TenantId) : OrganizationId.ForestWideOrgId;
            string         fqdn           = GetDarTask.ResolveServerId(base.CurrentOrganizationId).Fqdn;

            using (HostRpcClient hostRpcClient = new HostRpcClient(fqdn))
            {
                string          text    = Guid.NewGuid().ToString();
                TaskStoreObject darTask = new TaskStoreObject
                {
                    Id       = text,
                    TaskType = "Common.NoOp",
                    TenantId = organizationId.GetBytes(Encoding.UTF8)
                };
                hostRpcClient.SetDarTask(darTask);
                base.WriteObject("Task enqueued, waiting for completed status. ID:" + text);
                for (int i = 0; i < this.Retries; i++)
                {
                    TaskStoreObject[] darTask2 = hostRpcClient.GetDarTask(new DarTaskParams
                    {
                        TaskId = text
                    });
                    if (darTask2.Length > 1)
                    {
                        base.WriteError(new Exception("Unexected number of tasks returned by GetDarTask"), ErrorCategory.InvalidResult, darTask2.Length);
                        return;
                    }
                    if (darTask2.Length == 1)
                    {
                        base.WriteObject("Task state: " + darTask2[0].TaskState);
                        if (darTask2[0].TaskState == DarTaskState.Completed)
                        {
                            return;
                        }
                    }
                    else
                    {
                        base.WriteObject("No tasks found");
                    }
                    Thread.Sleep(1000);
                }
            }
            base.WriteError(new Exception("Operation timeout"), ErrorCategory.OperationTimeout, null);
        }
        protected override void InternalProcessRecord()
        {
            if (this.TenantId != null)
            {
                base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId);
            }
            string fqdn = GetDarTask.ResolveServerId(base.CurrentOrganizationId).Fqdn;
            DarTaskAggregateParams darTaskAggregateParams = new DarTaskAggregateParams
            {
                TenantId = base.CurrentOrganizationId.GetBytes(Encoding.UTF8),
                TaskType = this.TaskType
            };

            using (HostRpcClient hostRpcClient = new HostRpcClient(fqdn))
            {
                hostRpcClient.RemoveDarTaskAggregate(darTaskAggregateParams);
            }
        }
Example #6
0
 protected override void InternalProcessRecord()
 {
     if (this.TenantId != null)
     {
         try
         {
             base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId);
         }
         catch (ArgumentException exception)
         {
             base.WriteError(exception, ErrorCategory.InvalidArgument, this.TenantId);
             return;
         }
         base.WriteObject(string.Format(Strings.ResolvedOrg, base.CurrentOrganizationId));
         this.ExecutionUnit = GetDarTask.ResolveServerId(base.CurrentOrganizationId);
         base.WriteObject(string.Format(Strings.ResolvedServer, this.ExecutionUnit));
     }
     try
     {
         using (HostRpcClient hostRpcClient = new HostRpcClient(this.ExecutionUnit.Fqdn))
         {
             string darInfo = hostRpcClient.GetDarInfo();
             if (!string.IsNullOrEmpty(darInfo))
             {
                 foreach (string sendToPipeline in darInfo.Split(new char[]
                 {
                     '\n'
                 }))
                 {
                     base.WriteObject(sendToPipeline);
                 }
             }
         }
     }
     catch (ServerUnavailableException exception2)
     {
         base.WriteError(exception2, ErrorCategory.ConnectionError, this.ExecutionUnit.Fqdn);
     }
 }