다음을 통해 공유


분산-수집 샘플의 작동 방법

샘플 애플리케이션은 Scatter-Gather 여정 파일에서 로드된 여정이 포함된 SOAP 헤더 집합을 빌드하고, 디스크에서 지정된 메시지 파일을 로드하고, 메시지에 여정 헤더를 추가하고, 처리를 위해 램프를 통해 ESB에 제출합니다. 여정이 응답을 생성하는 경우 애플리케이션은 이를 수집하고 애플리케이션 창에 표시합니다.

여정 서비스에서 메시지의 여정 정보를 사용하는 방법을 이해하는 데 도움이 되도록 다음 목록에서는 ScatterGatherItinerary.xml이라는 샘플 여정 구성 파일을 보여 줍니다. 이 여정의 첫 번째 섹션에서는 두 개의 서비스 호출 단계를 지정합니다.

<Itinerary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" uuid="" beginTime=""   
    completeTime="" state="Pending" isRequestResponse="false"   
    xmlns="http://schemas.microsoft.biztalk.practices.esb.com/itinerary">  
  <ServiceInstance uuid="" name="ScatterGather" type="Orchestration"  
                   state="Pending" position="0"   
                   isRequestResponse="false" xmlns="" />  
  <Services xmlns="">  
    <Service uuid="" beginTime="" completeTime="" name="ScatterGather"  
             type="Orchestration" state="Pending" isRequestResponse="false"  
             position="0" serviceInstanceId="" />  
  </Services>  
  <Services xmlns="">  
    <Service uuid="" beginTime="" completeTime="" name="DynamicTest"  
             type="Messaging" state="Pending" isRequestResponse="false"  
             position="1" serviceInstanceId="" />  
  </Services>  
</Itinerary>  
...  

여정의 서비스 호출 단계 목록에는 다음 XML과 같이 여정 서비스가 여정에 정의된 각 서비스를 찾을 수 있도록 하는 확인자 및 연결 문자열의 세부 정보가 포함된 섹션이 있습니다.

<ResolverGroups xmlns="">  
 <Resolvers serviceId="ScatterGather0"><![CDATA[BRE:\\policy=ResolveEndPointScatterGather;version=;useMsg=;]]><![CDATA[UDDI3:\\serverUrl=http://localhost/uddi;bindingKey=uddi:esb:purchaseordersubmitorderservicebinding;credentialType=Ntlm]]></Resolvers>  
<Resolvers serviceId="DynamicTest1"><![CDATA[UDDI3:\\serverUrl=http://localhost/uddi;bindingKey=uddi:esb:orderfileservicebinding;credentialType=Ntlm]]>  
</Resolvers>  
  </ResolverGroups>  

이 예제에서는 두 확인자 연결 문자열이 이 서비스의 위치에 resolve 애플리케이션에서 SubmitPOService 웹 서비스를 두 번 실행합니다.http://localhost/ESB.CanadianServices/SubmitPOService.asmx). 메시지 컨텍스트는 브로커 오케스트레이션을 활성화할 첫 번째 여정 서비스로 지정하며 샘플에서 다음과 같이 정의됩니다.

(Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == "ScatterGather")  
     && (Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState ==   
    "Pending") && (Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType   
    == "Orchestration")  

Broker 오케스트레이션은 여정 단계에 대한 설정을 분석하고 여정 단계와 연결된 확인자 컬렉션을 검색합니다. 이러한 각 확인자에 대해 오케스트레이션은 Microsoft BizTalk ESB 도구 키트 확인자 및 어댑터 프레임워크를 사용하여 서비스 엔드포인트를 resolve. 그런 다음 Broker 오케스트레이션은 n개의 ServiceDispatcher 오케스트레이션을 비동기적으로 활성화합니다(여기서 n은 여정의 ScatterGather 서비스와 연결된 확인자 수임)는 다음 매개 변수를 사용하여 요청 메시지를 디스패치합니다.

  • TransportLocation. 확인자는 이 매개 변수를 채웁니다.

  • TransportType. 확인자는 이 매개 변수를 채웁니다.

  • ResolverDictionary. 이 매개 변수에는 구체적인 해결 프로그램 instance 채워진 확인자 팩트 컬렉션이 포함되어 있습니다.

  • InboundMessage. 이 매개 변수에는 여정이 포함된 원본 메시지가 포함됩니다.

  • ServiceResponsePort. 이 매개 변수는 ServiceDispatcher 오케스트레이션 인스턴스에서 응답을 수신하는 자체 상관 관계 응답 포트의 이름입니다.

    ServiceDispatcher 오케스트레이션의 각 instance ResolveMapScatterGather 정책을 사용하여 TransportTypeTransportLocation 속성에 따라 요청 및 응답 메시지에 대한 Microsoft BizTalk 맵 형식을 resolve. 오케스트레이션 인스턴스는 확인된 맵을 사용하여 인바운드 메시지를 웹 서비스 호출에 대한 요청 메시지로 변환합니다.

    ESB 어댑터 관리자는 요청 메시지에서 아웃바운드 전송 컨텍스트 속성을 설정합니다. 그러면 BizTalk는 ServiceRequestPort라는 요청 응답 포트로 전달합니다.

    서비스에서 응답 메시지를 받으면 ServiceDispatcher 오케스트레이션은 확인된 맵 정보를 사용하여 인바운드 응답 메시지를 정식 형식으로 변환합니다. 그런 다음, ServiceResponse 봉투 내에서 수정된 응답을 래핑하고 자체 상관 관계 포트를 통해 Broker 오케스트레이션으로 전달합니다. Broker 오케스트레이션은 다음 코드와 같이 들어오는 모든 응답을 집계하고 GlobalBank.ESB.ScatterGather.Processes.AggregatingPipeline을 사용하여 최종 응답 메시지를 준비합니다.

AggregatedResponse.Body = null;  
AggregatedResponse(*) = InboundMessage(*);  
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteSendPipeline(  
    typeof(GlobalBank.ESB.ScatterGather.Processes.AggregatingPipeline),  
    messageAggregator,AggregatedResponse);  

이 코드는 미리 정의된 봉투 내에서 응답의 전체 일괄 처리를 래핑합니다. 그런 다음 Broker 오케스트레이션은 다음 코드와 같이 여정을 DynamicTest 여정 단계로 진행합니다.

// Copy the context and advance the itinerary.  
OutboundMessage = AggregatedResponse.Body;  
OutboundMessage(*) = AggregatedResponse(*);  
// Advance the Itinerary to the next step.  
itinerary.Itinerary.Advance(OutboundMessage, itineraryStep);  

DynamicTest라는 서비스 유형 특성이 Messaging으로 설정되므로 ItineraryHelper 클래스는 확인자 속성을 OutboundMessage라는 메시지의 컨텍스트로 승격합니다. Broker 오케스트레이션은 이 메시지를 BizTalk 직접 바인딩된 포트로 보냅니다. 그런 다음 BizTalk는 메시지를 DynamicTestServiceName 구독이 나타내는 동적 송신 포트로 전달합니다. 이 송신 포트는 \Source\Samples\DynamicResolution\Test\Filedrop\Out 폴더에 대한 최종 집계 응답을 직렬화합니다.