Ejemplo n.º 1
0
        public void ExecuteScriptJob(JobSchedule job)
        {
            var activationStatus = this.jobScheduleRepository.StartJob(job);
            var workspace        = new RelativityWorkspace()
            {
                WorkspaceId = job.WorkspaceId
            };

            if (activationStatus == JobActivationStatus.Started)
            {
                try
                {
                    Logger.Trace($"Executing job {job.Id}");
                    RelativityHelper.InWorkspace(
                        (client, ws) =>
                    {
                        this.ExecuteJobInWorkspace(client, job, ws);
                    },
                        workspace,
                        this.relativityClient.GetRelativityClient());
                }
                catch (Exception ex)
                {
                    Logger.Warn(ex, $"Execution of job {job.Id} failed");
                    job.CurrentJobHistory.ResultText = "Exception: " + ex.ToString();
                    job.CurrentJobHistory.HasError   = true;
                }
                finally
                {
                    this.jobScheduleRepository.FinishJob(job);
                }
            }
        }
 private T InWorkspace <T>(Func <IRSAPIClient, RelativityWorkspace, T> action, RelativityWorkspace workspace)
 {
     return(RelativityHelper.InWorkspace(action, workspace, this.RelativityClient));
 }