QueueSystem.ReadJobStatus Method
Gets the status of the specified jobs in the Project Server Queuing Service.
Namespace: [QueueSystem Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/QueueSystem.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/QueueSystem.asmx?wsdl
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/ReadJobStatus", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/", _
ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadJobStatus ( _
qsrDS As QueueStatusRequestDataSet, _
includeWaitTime As Boolean, _
sortColumn As SortColumn, _
sortOrder As SortOrder _
) As QueueStatusDataSet
'Usage
Dim instance As QueueSystem
Dim qsrDS As QueueStatusRequestDataSet
Dim includeWaitTime As Boolean
Dim sortColumn As SortColumn
Dim sortOrder As SortOrder
Dim returnValue As QueueStatusDataSet
returnValue = instance.ReadJobStatus(qsrDS, _
includeWaitTime, sortColumn, sortOrder)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/ReadJobStatus", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/",
ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public QueueStatusDataSet ReadJobStatus(
QueueStatusRequestDataSet qsrDS,
bool includeWaitTime,
SortColumn sortColumn,
SortOrder sortOrder
)
Parameters
- qsrDS
Type: [QueueSystem Web service].QueueStatusRequestDataSet
The QueueStatusRequestDataSet.StatusRequestRow can specify the job completion state, tracking GUID (JobGroupGUID), job GUID, and queue message type.
- includeWaitTime
Type: System.Boolean
If true, include the expected wait time field.
- sortColumn
Type: [QueueSystem Web service].SortColumn
Specifies which field to sort in the list of jobs.
- sortOrder
Type: [QueueSystem Web service].SortOrder
Specifies whether to sort and in what order.
Return Value
Type: [QueueSystem Web service].QueueStatusDataSet
Status of the requested jobs, with the QueueStatusDataSet.StatusRow data for each job.
Remarks
ReadJobStatus can return status data for specific jobs or for a group of jobs which have the same tracking GUID.
PSI methods that use a queue begin with the word Queue in the method name. To set the tracking GUID for PSI methods that use the Project or Timesheet queue, add the tracking GUID to the SOAP header of each PSI Web service that you use for the queue method calls.
Project Server Permissions
Permission |
Description |
---|---|
Allows the user to manage the Project Server queue. Global permission. |
Examples
The following procedure shows how to modify the WebRequest method for the Project Web service.
To add a tracking GUID to the SOAP header for Project PSI calls: |
---|
|
The GetStatusOfQueueJobs method in the following example is in a class named QueueSystemUtilities. GetStatusOfQueueJobs is an overload of the same method name in the example for ReadJobStatusSimple. The method returns the status of all jobs with the same tracking ID. Jobs in the group are specified by the trackingGuid parameter. QueueSystemWS is an arbitrary name of the QueueSystem Web reference.
public QueueSystemWS.QueueStatusDataSet GetStatusOfQueueJobs(
QueueSystemWS.QueueSystem q,
Guid jobGuid,
Guid trackingGuid,
int jobState,
int msgType,
QueueSystemWS.SortColumn sortColumn,
QueueSystemWS.SortOrder sortOrder,
bool includeWaitTime)
{
QueueSystemWS.QueueStatusRequestDataSet dsQStatusRequest =
new QueueSystemWS.QueueStatusRequestDataSet();
QueueSystemWS.QueueStatusRequestDataSet.StatusRequestRow qStatusRow =
dsQStatusRequest.StatusRequest.NewStatusRequestRow();
qStatusRow.JobGUID = jobGuid;
qStatusRow.JobGroupGUID = trackingGuid;
if (jobState != 0)
qStatusRow.JobCompletionState = jobState;
if (msgType != 0)
qStatusRow.MessageType = msgType;
dsQStatusRequest.StatusRequest.AddStatusRequestRow(qStatusRow);
QueueSystemWS.QueueStatusDataSet dsQStatus = q.ReadJobStatus(dsQStatusRequest,
includeWaitTime,
sortColumn,
sortOrder);
return dsQStatus;
}
The following code fragment makes normal calls to the PSI methods where the Project object adds the tracking GUID to the SOAP header, as described in the previous procedure.
using System.Threading;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
private static ProjectWS.ProjectDerived projectDerived =
new ProjectWS.ProjectDerived();
private static QueueSystemWS.QueueSystem queueSystem =
new QueueSystemWS.QueueSystem();
private static QueueSystemUtils queueSystemUtils = new QueueSystemUtils();
. . .
ProjectWS.ProjectDataSet dsProject =
new ProjectWS.ProjectDataSet();
ProjectWS.ProjectDataSet.ProjectRow projectRow =
dsProject.Project.NewProjectRow();
Guid projectGuid = Guid.NewGuid();
projectRow.PROJ_UID = projectGuid;
projectRow.PROJ_NAME = "Name of Project";
projectRow.PROJ_TYPE =
Convert.ToInt32(PSLibrary.Project.ProjectType.Project);
dsProject.Project.AddProjectRow(projectRow);
// Create the queue job and tracking GUIDs, and then set the tracking
// GUID for SOAP calls to the derived Project object.
Guid jobGuid = Guid.NewGuid();
Guid trackingGuid = Guid.NewGuid();
SomeNameSpace.ProjectWS.ProjectDerived.SetTrackingGuid(trackingGuid);
bool validateOnly = false;
// Create and save project to the Draft database.
projectDerived.QueueCreateProject(jobGuid, dsProject, validateOnly);
// Wait a few seconds, or create a WaitForQueue method.
Thread.Sleep(3000);
ProjectWS.ProjectRelationsDataSet dsProjectRelations =
new ProjectWS.ProjectRelationsDataSet();
jobGuid = Guid.NewGuid();
string wssUrl = "" // Default SharePoint project workspace,
bool fullPublish = true;
// Publish the project to the Published database.
dsProjectRelations = projectDerived.QueuePublish(jobGuid, projectGuid, fullPublish, wssUrl);
Thread.Sleep(500);
jobGuid = Guid.Empty;
int jobState = (int)QueueSystemWS.JobState.Unknown;
int msgType = (int) QueueSystemWS.QueueMsgType.Unknown;
bool includeWaitTime = true;
QueueSystemWS.SortColumn sortColumn = QueueSystemWS.SortColumn.Undefined;
QueueSystemWS.SortOrder sortOrder = QueueSystemWS.SortOrder.Undefined;
WebSvcQueueSystem.QueueStatusDataSet dsQStatus =
queueSystemUtils.GetStatusOfQueueJobs(queueSystem, jobGuid, trackingGuid,
jobState, msgType, sortColumn, sortOrder, includeWaitTime);
. . .
Both the QueueCreateProject and QueuePublish calls use the same tracking GUID, which is set in the SOAP headers by the ProjectDerived object. The QueuePublish method spawns additional queue jobs such as sending the published project data to the Reporting database. QueueStatusDataSet lists the status of all jobs that have the same tracking ID and have either completed processing or are on the queue. The following table shows some of the fields in the QueueStatusDataSet.Status table after running the previous code.
Queue ID |
Message Type |
Job Completion State |
Queue Position |
Percent Complete |
Queue Entry Time |
Queue Processing Time |
Queue Completed Time |
Wait Time |
---|---|---|---|---|---|---|---|---|
1 |
22 |
4 |
-1 |
100 |
6/26/2011 14:06 |
6/26/2011 14:06 |
6/26/2011 14:06 |
0 |
1 |
30 |
3 |
3 |
100 |
6/26/2011 14:06 |
6/26/2011 14:06 |
0 |
|
1 |
24 |
1 |
4 |
0 |
6/26/2011 14:06 |
1 |
QueueMessageType 22 is ProjectCreate. The job is no longer on the queue; JobState 4 is Success.
QueueMessageType 30 is PublishNotifications. The job is third on the queue; JobState 3 is QueueJobProcessing.
QueueMessageType 24 is ProjectPublish. The job is fourth on the queue; JobState 1 is ReadyForProcessing. The expected wait time is one second.