QueueSystem.GetJobGroupWaitTime 方法
會決定在工作群組中,指定類型的程序工作之佇列的預計間隔時間。
命名空間: WebSvcQueueSystem
組件: ProjectServerServices (在 ProjectServerServices.dll 中)
語法
'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/GetJobGroupWaitTime", 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 GetJobGroupWaitTime ( _
trackingID As Guid, _
messageType As QueueMsgType _
) As Integer
'用途
Dim instance As QueueSystem
Dim trackingID As Guid
Dim messageType As QueueMsgType
Dim returnValue As Integer
returnValue = instance.GetJobGroupWaitTime(trackingID, _
messageType)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/GetJobGroupWaitTime", 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 int GetJobGroupWaitTime(
Guid trackingID,
QueueMsgType messageType
)
參數
trackingID
類型:System.Guid追蹤指派給多個工作的 GUID (JobGroupGUID)。
messageType
類型:WebSvcQueueSystem.QueueMsgTypeQueueMsgType列舉值。
傳回值
類型:System.Int32
預期的工作使用相同的trackingID秒與指定類型,才可完成的數字。
備註
之工作的預期的等待時間才大約,根據類似類型的工作的平均等待時間。GetJobGroupWaitTime還需考慮工作已在佇列和工作相互關聯優先順序的位置。
PSI 方法使用的專案或時程表佇列名稱開始使用佇列,例如QueueCreateProject和QueueUpdateTimesheet。若要設定的 PSI 方法使用的專案或時程表佇列追蹤 GUID,新增您使用的佇列方法呼叫每個 PSI Web 服務的 SOAP 標頭的追蹤 GUID。
Project Server 權限
權限 |
描述 |
---|---|
可讓使用者管理 Project Server 佇列。通用權限。 |
範例
下列程序示範如何修改 [Project Web 服務的WebRequest方法。
下列範例會將GetExpectedGroupWaitTime方法是在名為QueueSystemUtilities類別。如專案發佈傳送給報表資料庫的資料,則方法會傳回預期的等待時間。trackingGuid參數會指定群組中的工作。QueueSystemWS是QueueSystem Web 參考 (英文) 任意名稱。
public int GetExpectedGroupWaitTime(QueueSystemWS.QueueSystem q,
Guid trackingGuid, QueueSystemWS.QueueMsgType msgType)
{
int wait = q.GetJobGroupWaitTime(trackingGuid, msgType);
return wait;
}
下列程式碼片段會 PSI 方法的一般呼叫其中Project物件新增至 SOAP 標題中的追蹤 GUID 在先前程序中所述。
using System.Threading;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
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);
// Try various wait times to see the effect of additional queue jobs
// spawned by QueuePublish.
Thread.Sleep(500);
QueueSystemWS.QueueMsgType msgType = QueueSystemWS.QueueMsgType.ReportingProjectPublish;
int jobGroupWaitTime = queueSystemUtils.GetExpectedGroupWaitTime(queueSystem, trackingGuid, msgType);
string waitTime = "After QueuePublish:\t\t" + jobGroupWaitTime.ToString() + " seconds for the ReportingProjectPublish job";
. . .
QueueCreateProject和QueuePublish通話使用相同的 tracking SOAP 標頭設ProjectDerived物件的 GUID。QueuePublish方法會產生額外的佇列工作,例如已發佈的專案資料傳送到報表資料庫。jobGroupWaitTime值顯示僅ReportingProjectPublish工作的預期的等待時間。