2014-12-17 6 views
1

안녕하세요 저는 Any Point Studio를 사용하고 있으며 Mule이 경로에서 읽는 시나리오를 가지고 있습니다. 경로에서 두 개의 파일을 읽고 두 파일을 모두 처리한다고 가정합니다. 파일을 2 개의 개별 메시지로 결합합니다. 둘을 하나로 결합하고 싶습니다.한 메시지에 여러 메시지를 집계하고 Mule에서 인쇄하는 방법

애그리 게이터 구성 요소보다 먼저 정의해야하는 이유는 MULE_CORRELATION_GROUP_SIZE입니다.

맞춤 어 그리 게이터를 사용하여이를 달성하기위한 코드를 공유하거나 더 좋은 방법입니다. enter image description here

<?xml version="1.0" encoding="UTF-8"?> 
 

 
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
 
\t xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.5.0" 
 
\t xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 
\t xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
 
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd 
 
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd 
 
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd 
 
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd"> 
 
    <file:connector name="File" streaming="true" autoDelete="false" validateConnections="true" doc:name="File"/> 
 
    <flow name="mule-file-aggregatorFlow1" doc:name="mule-file-aggregatorFlow1"> 
 
     <file:inbound-endpoint path="\\mulespace\foldername" responseTimeout="10000" doc:name="File" connector-ref="File"> 
 
     </file:inbound-endpoint> 
 
     <file:file-to-string-transformer doc:name="File to String"/> 
 
     <message-properties-transformer doc:name="Message Properties"> 
 
     <add-message-property key="MULE_CORRELATION_GROUP_SIZE" value="2" /> 
 
     </message-properties-transformer> 
 
     <custom-aggregator failOnTimeout="true" class="com.mine.custom.CustomAggregator" doc:name="Custom Aggregator"/> 
 
     <json:object-to-json-transformer doc:name="Object to JSON"/> 
 
     <logger message="#[message.payload]" level="INFO" doc:name="Logger"/> 
 
    </flow> 
 
</mule>

+0

당신은 파일의 이름 패턴을 설명 할 수 있습니까? –

+0

정상 .txt 파일 – Utsav

+0

이름 패턴을 의미합니다. 그 두 파일을 어떻게 telate해야합니까? –

답변

2

사용이 파일 후 : 인바운드 엔드 포인트 :

<scripting:component doc:name="Groovy"> 
      <scripting:script engine="Groovy"><![CDATA[long now = new java.util.Date().getTime(); 
       long mod = now % 2000; 
       message.setCorrelationId(String.valueOf(now - mod)); 
       message.setCorrelationGroupSize(100); 
       return message; 
      ]]></scripting:script> 
     </scripting:component> 
     <collection-aggregator timeout="3000" failOnTimeout="false" doc:name="Collection Aggregator"/> 
     <combine-collections-transformer doc:name="Combine Collections"/> 
+0

을 사용하십시오. MULE_CORRELATION_GROUP_SIZE의 용도는 무엇입니까? 위의 스크립트에서 여러분은 setCorrelationGroupSize를 설정하고 있습니다. 같은, 그냥 그룹 크기 설정의 사용을 알고 싶다. – Utsav