코드를 통해 Biztalk 수신 위치를 자동화하는 방법이 있습니까?
-
19-09-2019 - |
문제
Biztalk에서 수신 위치의 켜지거나 끄는 방법을 자동화하는 방법이 있습니까? 이런 종류의 API 나 그와 같은 종류가 있어야합니다. C#에서 작업하는 것을 선호하지만 WMI 또는 일종의 스크립트도 작동합니다.
해결책
ExplorErom 외에도 발견 된 바와 같이 WMI를 사용하여 수신 위치 (및 제어 송신 포트)를 활성화/비활성화 할 수도 있습니다.
나는 그런 일을하는 방법을 보여주는 샘플 PowerShell 스크립트가 있습니다. 여기, 당신이 관심이 있다면.
다른 팁
해결책을 찾았습니다. Microsoft.biztalk.explorerom.dll은 내가 원하는 것 같습니다. 다음은 다른 사람을 시작 해야하는 Biztalk 문서의 발췌문입니다.
using System;
using Microsoft.BizTalk.ExplorerOM;
public static void EnumerateOrchestrationArtifacts()
{
// Connect to the local BizTalk Management database
BtsCatalogExplorer catalog = new BtsCatalogExplorer();
catalog.ConnectionString = "Server=.;Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;";
// Enumerate all orchestrations and their ports/roles
Console.WriteLine("ORCHESTRATIONS: ");
foreach(BtsAssembly assembly in catalog.Assemblies)
{
foreach(BtsOrchestration orch in assembly.Orchestrations)
{
Console.WriteLine(" Name:{0}\r\n Host:{1}\r\n Status:{2}",
orch.FullName, orch.Host.Name, orch.Status);
// Enumerate ports and operations
foreach(OrchestrationPort port in orch.Ports)
{
Console.WriteLine("\t{0} ({1})",
port.Name, port.PortType.FullName);
foreach(PortTypeOperation operation in port.PortType.Operations)
{
Console.WriteLine("\t\t" + operation.Name);
}
}
// Enumerate used roles
foreach(Role role in orch.UsedRoles)
{
Console.WriteLine("\t{0} ({1})",
role.Name, role.ServiceLinkType);
foreach(EnlistedParty enlistedparty in role.EnlistedParties)
{
Console.WriteLine("\t\t" + enlistedparty.Party.Name);
}
}
// Enumerate implemented roles
foreach(Role role in orch.ImplementedRoles)
{
Console.WriteLine("\t{0} ({1})",
role.Name, role.ServiceLinkType);
}
}
}
}
하나의 경고, 분명히이 DLL은 64 비트를 지원하지 않습니다. 나는 단순한 유틸리티 만 쓰기 때문에 나에게 큰 문제는 아니지만 (32 비트로 컴파일하는 것만) 알고 있어야합니다.
해결책을 찾은 것 같습니다.
PowerShell, Explorerom 및 Biztalk API를 사용하여 Biztalk 아티팩트를 다양한 상태로 설정하는 유사한 대안을 언급하고 싶었습니다.
그 중 하나 인 위치를받습니다.
스크립트는 XML 구성 파일을 수락하며, 여기서 아티팩트를 나열하고 설정하려는 상태를 나열합니다.
스크립트는 Microsoft Script Center에 게시되었습니다.http://gallery.technet.microsoft.com/scriptcenter/set-artifact-status-270f43a0
Alhambraeidos에 대한 응답으로. 다음은 Windows 앱에서 사용한 코드의 발췌문이 있습니다.
/// <summary>
/// Gets or sets the biz talk catalog.
/// </summary>
/// <value>The biz talk catalog.</value>
private BtsCatalogExplorer BizTalkCatalog { get; set; }
/// <summary>
/// Initializes the biz talk artifacts.
/// </summary>
private void InitializeBizTalkCatalogExplorer()
{
// Connect to the local BizTalk Management database
BizTalkCatalog = new BtsCatalogExplorer();
BizTalkCatalog.ConnectionString = "server=BiztalkDbServer;database=BizTalkMgmtDb;integrated security=true";
}
/// <summary>
/// Gets the location from biz talk.
/// </summary>
/// <param name="locationName">Name of the location.</param>
/// <returns></returns>
private ReceiveLocation GetLocationFromBizTalk(string locationName)
{
ReceivePortCollection receivePorts = BizTalkCatalog.ReceivePorts;
foreach (ReceivePort port in receivePorts)
{
foreach (ReceiveLocation location in port.ReceiveLocations)
{
if (location.Name == locationName)
{
return location;
}
}
}
throw new ApplicationException("The following receive location could not be found in the BizTalk Database: " + locationName);
}
/// <summary>
/// Turns the off receive location.
/// </summary>
/// <param name="vendorName">Name of the vendor.</param>
public void TurnOffReceiveLocation(string vendorName)
{
ReceiveLocation location = Locations[vendorName].ReceiveLocation;
location.Enable = false;
BizTalkCatalog.SaveChanges();
}
"위치"라는 수신 위치의 사전을 만들었던 것처럼, 내가 빠진 것이 있다는 것을 알 수 있지만, 아이디어를 얻을 수 있어야합니다. 상호 작용하려는 Biztalk 객체의 경우 패턴이 거의 적용됩니다.