Biztalk中碰到的难题?
如果Biztalk中的某一个业务流程被挂起或正在执行,如何通过Client程序去终止该业务流程?
能解决该问题者,高分相谢!!!!!!!
问题点数:100、回复次数:6Top
1 楼OSDN(相忘于江湖)回复于 2005-05-11 09:33:12 得分 10
能否具体解释一下这里的Client程序,譬如?Top
2 楼lym51(老玉米)回复于 2005-05-11 10:20:30 得分 0
就是我用自己写的exe程序去终止Biztalk中被挂起的业务流程实例。Top
3 楼lym51(老玉米)回复于 2005-05-19 17:31:38 得分 0
现在到这里来的高手越来越少了!!!!!!!!!!!!!!!Top
4 楼lym51(老玉米)回复于 2005-05-21 10:34:02 得分 0
自己顶一下,唉!!!!!!!!!!!!Top
5 楼xz_king(西煞魄工人)回复于 2005-05-24 00:45:39 得分 10
BTS主要用来完成一个完整的业务流程,中间出现的任务问题都可以在HAT中找到答案。
如果你非要实现使用Client去控制一个流程,就要对MessageBoxDB非常了解,并对数据直接进行操作。
以我现在对BTS的研究成度,暂时还无法找到一个合适的方案来解决你的问题。
Top
6 楼OSDN(相忘于江湖)回复于 2005-05-31 09:55:19 得分 80
可以通过调用Biztalk的WMI对象来解决这个问题,如下示例代码:
using System.Management;
public void ResumeSvcInstByOrchestrationName(string strOrchestrationName)
{
try
{
const uint SERVICE_CLASS_ORCHESTRATION = 1;
const uint SERVICE_STATUS_SUSPENDED_RESUMABLE = 4;
const uint REGULAR_RESUME_MODE = 1;
// Query for suspended (resumable) service instances of the specified orchestration
// Suggestion: Similar queries can be written for Suspend/Terminate operations by using different ServiceStatus value. See MOF definition for details.
string strWQL = string.Format(
"SELECT * FROM MSBTS_ServiceInstance WHERE ServiceClass = {0} AND ServiceStatus = {1} AND ServiceName = \"{2}\"",
SERVICE_CLASS_ORCHESTRATION.ToString(), SERVICE_STATUS_SUSPENDED_RESUMABLE.ToString(), strOrchestrationName);
ManagementObjectSearcher searcherServiceInstance = new ManagementObjectSearcher (new ManagementScope ("root\\MicrosoftBizTalkServer"), new WqlObjectQuery(strWQL), null);
int nNumSvcInstFound = searcherServiceInstance.Get().Count;
// If we found any
if ( nNumSvcInstFound > 0 )
{
// Construct ID arrays to be passed into ResumeServiceInstancesByID() method
string[] InstIdList = new string[nNumSvcInstFound];
string[] ClassIdList = new string[nNumSvcInstFound];
string[] TypeIdList = new string[nNumSvcInstFound];
string strHost = string.Empty;
string strReport = string.Empty;
int i = 0;
foreach ( ManagementObject objServiceInstance in searcherServiceInstance.Get() )
{
// It is safe to assume that all service instances belong to a single Host.
if ( strHost == string.Empty )
strHost = objServiceInstance["HostName"].ToString();
ClassIdList[i] = objServiceInstance["ServiceClassId"].ToString();
TypeIdList[i] = objServiceInstance["ServiceTypeId"].ToString();
InstIdList[i] = objServiceInstance["InstanceID"].ToString();
strReport += string.Format(" {0}\n", objServiceInstance["InstanceID"].ToString());
i++;
}
// Load the MSBTS_HostQueue with Host name and invoke the "ResumeServiceInstancesByID" method
string strHostQueueFullPath = string.Format("root\\MicrosoftBizTalkServer:MSBTS_HostQueue.HostName=\"{0}\"", strHost);
ManagementObject objHostQueue = new ManagementObject(strHostQueueFullPath);
// Note: The ResumeServiceInstanceByID() method processes at most 2047 service instances with each call.
// If you are dealing with larger number of service instances, this script needs to be modified to break down the
// service instances into multiple batches.
objHostQueue.InvokeMethod("ResumeServiceInstancesByID",
new object[] {ClassIdList, TypeIdList, InstIdList, REGULAR_RESUME_MODE}
);
Console.WriteLine( string.Format("Service instances with the following service instance IDs have been resumed:\n{0}", strReport) );
}
else
{
System.Console.WriteLine(string.Format("There is no suspended (resumable) service instance found for orchestration '{0}'.", strOrchestrationName));
}
}
catch(Exception excep)
{
Console.WriteLine("Error: " + excep.Message);
}
}Top




