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开始。若要设置的跟踪 GUID 使用项目或时间表队列的 PSI 方法,将添加到的每个用于队列方法调用的 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对象将跟踪 GUID 添加到的 SOAP 标头,其中一过程中所述。
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呼叫使用的相同的跟踪 GUID 的 SOAP 标头中设置由ProjectDerived对象。QueuePublish方法生成如已发布的项目数据发送到报告数据库的其他队列作业。jobGroupWaitTime值显示仅ReportingProjectPublish作业的预期的等待时间。