2012-12-27 2 views
2

나의 사용 사례는 smne 데이터로 입력을 풍부하게하고 아웃 바운드 엔드 포인트로 보내야합니다.병렬 발신 전화 걸기 방법

풍부한 데이터는 두 개의 웹 서비스를 호출 한 다음 응답에서 데이터를 추출하여 얻습니다. 이 추출 된 데이터는 입력 XML로 확장되어 아웃 바운드 엔드 포인트로 보내집니다.

내가해야하는 두 가지 웹 서비스 호출은 다른 것에 대한 종속성이 없으므로 병렬이어야합니다. 이렇게하면 처리 시간을 절약 할 수 있습니다.

이 병렬 처리를 Mule의 플로우에서 어떻게 구현할 수 있는지 제안 해주십시오.

참고 : 모든 흐름 제어를 사용해 보았지만 웹 서비스 (하위 흐름)를 순차적으로 호출하는 것 같습니다.

내 추상 흐름은 다음과 같습니다.

<flow name="mainFlow"> 
    <inbound-endpoint> ..... 

    <some validation> 

    <setting some flow variables> 

    <!-- Now make calls to the sub-flows which has some processing of the input and make some web-service calls --> 
    <all> 
     <flow-ref name="myFlow1" /> 
     <flow-ref name="myFlow2" /> 
     <flow-ref name="myFlow3" /> 
    </all> 

    <enrich the input with the data obtained from the output of the above three flows> 

    <outbound-endpoint> 
</flow> 



<flow name="myFlow1"> 
    <some transformer to transform the payload provided > 

    < the tran sformed payload is passed as input to the web-service call> 

    <http:outbound-endpoint ...> 

    <transform the reply from the web-service call> 
</flow> 



<flow name="myFlow2"> 
    <some transformer to transform the payload provided > 

    < the tran sformed payload is passed as input to the web-service call> 

    <http:outbound-endpoint ...> 

    <transform the reply from the web-service call> 
</flow> 



<flow name="myFlow3"> 
    <some transformer to transform the payload provided to it> 

    < the tran sformed payload is passed as input to the web-service call> 

    <http:outbound-endpoint ...> 

    <transform the reply from the web-service call> 
</flow> 
+2

포크와 조인간에 WS 호출을 사용하여 포크 조인 패턴을 사용하지 않겠습니까? –

+0

David Dossot에게 감사드립니다. :) – user1760178

+0

제 경우에는 모든 흐름 제어를 사용하여 두 개의 하위 흐름으로 입력을 보내고 있습니다. 웹 서비스 호출에 포크 조인 패턴을 어떻게 사용할 수 있는지 잘 모르겠습니다. 또한 나는 "아웃 바운드 엔드 포인트"라고 직접 부르지 않습니다. 서브 플로우에 대한 호출을 만들어야하는데, 여기에서 웹 서비스에 대한 호출이 이루어지기 전에 입력 메시지에 대한 일부 처리가 발생합니다. 제가 여기에 뭔가 빠졌는지 알려주세요. – user1760178

답변

2

다음은 두 개의 HTTP 아웃 바운드 끝점을 사용하여 포크/조인을 만드는 한 가지 방법을 보여주는 간단한 구성입니다. 세 번째 끝점을 추가하려면 MULE_CORRELATION_GROUP_SIZE3으로 설정하고 MULE_CORRELATION_SEQUENCE을 세 번째 async flow-ref에서 3으로 설정하십시오.

<flow name="fork"> 
    <vm:inbound-endpoint path="fork.in" /> 
    <set-property propertyName="MULE_CORRELATION_GROUP_SIZE" 
     value="2" /> 
    <all enableCorrelation="IF_NOT_SET"> 
     <async> 
      <set-property propertyName="MULE_CORRELATION_SEQUENCE" 
       value="1" /> 
      <flow-ref name="parallel1" /> 
     </async> 
     <async> 
      <set-property propertyName="MULE_CORRELATION_SEQUENCE" 
       value="2" /> 
      <flow-ref name="parallel2" /> 
     </async> 
    </all> 
</flow> 

<sub-flow name="parallel1"> 
    <logger level="INFO" message="parallel1: processing started" /> 
    <http:outbound-endpoint address="..." 
     exchange-pattern="request-response" /> 
    <logger level="INFO" message="parallel1: processing finished" /> 
    <flow-ref name="join" /> 
</sub-flow> 

<sub-flow name="parallel2"> 
    <logger level="INFO" message="parallel2: processing started" /> 
    <http:outbound-endpoint address="..." 
     exchange-pattern="request-response" /> 
    <logger level="INFO" message="parallel2: processing finished" /> 
    <flow-ref name="join" /> 
</sub-flow> 

<sub-flow name="join"> 
    <collection-aggregator timeout="6000" 
     failOnTimeout="true" /> 
    <combine-collections-transformer /> 
    <logger level="INFO" 
     message="Continuing processing of: #[message.payloadAs(java.lang.String)]" /> 
</sub-flow> 

편집 : 위의 구성에서 수집기는 6 초 후에 시간 초과됩니다. 이는 실제 사용 사례에 비해 너무 짧을 수 있습니다. 또한 아웃 바운드 HTTP 엔드 포인트 상호 작용이 모두 성공하지 못했을 때 원하는 동작이 아닐 수 있으므로 타임 아웃이 실패로 설정됩니다. 사용 사례를 기반으로 결정하는 것은 사용자의 몫입니다.

+0

나는 당신에게 해결책을 시도했다. 그러나 이것은 "수집 - 집계 원"을 강타합니다. 타임 아웃 후에는 예외가 표시됩니다. 두 하위 흐름 모두 결과를 반환했음을 알 수있었습니다. 2012-12-31 11 : 40 : 41,604 ERROR [Pref_Flow.event.correlator] exception.AbstractExceptionListener (AbstractExceptionListener.java:296) - *********** 메시지 : 대기 중 상관 시간이 초과되었습니다. id가있는 이벤트 그룹 on : "ccc5b81c-5368-11e2-91a5-d984788f3b10". 메시지 페이로드 유형 : CopyOnWriteArrayList 코드 : MULE_ERROR - 2 ------------ – user1760178

+0

예외 스택 : 1. ID가 "ccc5b81c-5368 인 이벤트 그룹을 기다리는 동안 상관 관계 시간 초과입니다. -11e2-91a5-d984788f3b10 ". 메시지 페이로드 유형 : CopyOnWriteArrayList (org.mule.routing.correlation.CorrelationTimeoutException) org.mule.routing.correlation.EventCorrelator : 412 루트 예외 스택 추적 : org.mule.routing.correlation.CorrelationTimeoutException : 상관 시간이 초과되었습니다. while ID가 "ccc5b81c-5368-11e2-91a5-d984788f3b10"인 이벤트 그룹에서 대기 중입니다. org.mule.routing.correlation.EventCorrelator.handleGroupExpiry (EventCorrelator.java:412) – user1760178

+1

문제가 무엇인지 잘 모르겠습니다. 설정이 제대로 작동합니다. 내 솔루션 끝에 EDIT 노트를 추가하여 사용 사례에 맞게 조정해야 할 애그리 게이터 설정에주의를 기울이십시오. –