GetJobInformation Method
Summary
Retrieves information about the specified job.
Example
using LeadtoolsJobProcessorExamples.JobService;
public void GetJobInformation(string jobID)
{
using (JobServiceClient jobServiceClient = new JobServiceClient())
{
GetJobInformationRequest getJobInformationRequest = new GetJobInformationRequest();
getJobInformationRequest.ID = jobID;
GetJobInformationResponse getJobInformationResponse = jobServiceClient.GetJobInformation(getJobInformationRequest);
if (getJobInformationResponse.JobInformation != null && !String.IsNullOrEmpty(getJobInformationResponse.JobInformation.ID))
{
//Show the job information
Console.WriteLine(String.Format("Job ID: {0}", getJobInformationResponse.JobInformation.ID));
Console.WriteLine(String.Format("Add Time: {0}", getJobInformationResponse.JobInformation.AddedTime));
Console.WriteLine(String.Format("Status: {0}", getJobInformationResponse.JobInformation.Status));
Console.WriteLine(String.Format("Attempts: {0}", getJobInformationResponse.JobInformation.Attempts));
if (!String.IsNullOrEmpty(getJobInformationResponse.JobInformation.JobType))
Console.WriteLine(String.Format("Job Type: {0}", getJobInformationResponse.JobInformation.JobType));
if (getJobInformationResponse.JobInformation.LastStartedTime != null)
Console.WriteLine(String.Format("Last Started Time: {0}", getJobInformationResponse.JobInformation.LastStartedTime));
if (getJobInformationResponse.JobInformation.LastUpdatedTime != null)
Console.WriteLine(String.Format("Last Updated Time: {0}", getJobInformationResponse.JobInformation.LastUpdatedTime));
if (getJobInformationResponse.JobInformation.Status == JobStatus.Started)
Console.WriteLine(String.Format("Progress: {0}", getJobInformationResponse.JobInformation.Percentage));
if (!String.IsNullOrEmpty(getJobInformationResponse.JobInformation.Worker))
Console.WriteLine(String.Format("Worker: {0}", getJobInformationResponse.JobInformation.Worker));
if (getJobInformationResponse.JobInformation.Status == JobStatus.Completed)
Console.WriteLine(String.Format("Completed Time: {0}", getJobInformationResponse.JobInformation.CompletedTime));
if (getJobInformationResponse.JobInformation.Status == JobStatus.Failed)
{
Console.WriteLine(String.Format("Failed Time: {0}", getJobInformationResponse.JobInformation.FailedTime));
Console.WriteLine(String.Format("Error ID: {0}", getJobInformationResponse.JobInformation.FailureInformation.FailedErrorID));
Console.WriteLine(String.Format("Error Message: {0}", getJobInformationResponse.JobInformation.FailureInformation.FailedMessage));
}
}
}
}
Public Sub GetJobInformation(ByVal jobID As String)
Using jobServiceClient As JobServiceClient = New JobServiceClient()
Dim getJobInformationRequest As GetJobInformationRequest = New GetJobInformationRequest()
getJobInformationRequest.ID = jobID
Dim getJobInformationResponse As GetJobInformationResponse = jobServiceClient.GetJobInformation(getJobInformationRequest)
If Not getJobInformationResponse.JobInformation Is Nothing AndAlso (Not String.IsNullOrEmpty(getJobInformationResponse.JobInformation.ID)) Then
'Show the job information
Console.WriteLine(String.Format("Job ID: {0}", getJobInformationResponse.JobInformation.ID))
Console.WriteLine(String.Format("Add Time: {0}", getJobInformationResponse.JobInformation.AddedTime))
Console.WriteLine(String.Format("Status: {0}", getJobInformationResponse.JobInformation.Status))
Console.WriteLine(String.Format("Attempts: {0}", getJobInformationResponse.JobInformation.Attempts))
If (Not String.IsNullOrEmpty(getJobInformationResponse.JobInformation.JobType)) Then
Console.WriteLine(String.Format("Job Type: {0}", getJobInformationResponse.JobInformation.JobType))
End If
If Not getJobInformationResponse.JobInformation.LastStartedTime Is Nothing Then
Console.WriteLine(String.Format("Last Started Time: {0}", getJobInformationResponse.JobInformation.LastStartedTime))
End If
If Not getJobInformationResponse.JobInformation.LastUpdatedTime Is Nothing Then
Console.WriteLine(String.Format("Last Updated Time: {0}", getJobInformationResponse.JobInformation.LastUpdatedTime))
End If
If getJobInformationResponse.JobInformation.Status = JobStatus.Started Then
Console.WriteLine(String.Format("Progress: {0}", getJobInformationResponse.JobInformation.Percentage))
End If
If (Not String.IsNullOrEmpty(getJobInformationResponse.JobInformation.Worker)) Then
Console.WriteLine(String.Format("Worker: {0}", getJobInformationResponse.JobInformation.Worker))
End If
If getJobInformationResponse.JobInformation.Status = JobStatus.Completed Then
Console.WriteLine(String.Format("Completed Time: {0}", getJobInformationResponse.JobInformation.CompletedTime))
End If
If getJobInformationResponse.JobInformation.Status = JobStatus.Failed Then
Console.WriteLine(String.Format("Failed Time: {0}", getJobInformationResponse.JobInformation.FailedTime))
Console.WriteLine(String.Format("Error ID: {0}", getJobInformationResponse.JobInformation.FailureInformation.FailedErrorID))
Console.WriteLine(String.Format("Error Message: {0}", getJobInformationResponse.JobInformation.FailureInformation.FailedMessage))
End If
End If
End Using
End Sub