0
背景:我們正在構建一個應用程序MuleSoft,並且作爲要求的一部分,我們必須向csv文件寫入大量記錄(大約30K)。在此之前,我們需要以XML的形式提取數據,這些數據來自DB2的獨立數據。然後我們應用一些轉換/映射規則,最後我們將數據寫入csv文件並FTP將csv文件。我附上XML。將大量記錄寫入CSV文件 - 不工作
問題:該流程僅在處理大約2500-2600條記錄後才掛起。它沒有拋出任何錯誤。它只是呆在那裏,它什麼都不做。我們嘗試瞭如下的選項:1.將流程作爲mule批處理流程的一部分。沒有差異觀察2.設置最大錯誤計數= -1,因爲我們發現這在博客
請如果有人可以提供任何建議,這將是非常有用的。寫入文件時記錄數是否有限制?
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:batch="http://www.mulesoft.org/schema/mule/batch" xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.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/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
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/batch http://www.mulesoft.org/schema/mule/batch/current/mule-batch.xsd">
<db:generic-config name="Generic_Database_Configuration1" url="jdbc:db2://faadbcdd0017:60004/MATIUT:user=mat_adm;password=q1w2e3r4;" driverClassName="com.ibm.db2.jcc.DB2Driver" doc:name="Generic Database Configuration"/>
<file:connector name="File" outputPattern="Carfax.csv" writeToDirectory="C:\opt\CCM\Output\IUT" autoDelete="false" outputAppend="true" streaming="true" validateConnections="true" doc:name="File"/>
<file:connector name="File1" outputPattern="sample.txt" readFromDirectory="C:\opt\CCM" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<batch:job name="batch2Batch">
<batch:input>
<logger message="Startr>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" level="INFO" doc:name="Logger"/>
<foreach doc:name="For Each">
<db:select config-ref="Generic_Database_Configuration1" doc:name="Database">
<db:parameterized-query><![CDATA[select MSG_ID,TEMPL_ID,MSG_DATA,EMAIL_CHNL_IND,PUSH_CHNL_IND, INSERT_TMSP,UID FROM IUT.message_master WHERE INSERT_TMSP between
(CURRENT TIMESTAMP- HOUR (CURRENT TIMESTAMP) HOURS- MINUTE(CURRENT TIMESTAMP) MINUTES- SECOND(CURRENT TIMESTAMP) SECONDS
- MICROSECOND(CURRENT TIMESTAMP) MICROSECONDS) and ((CURRENT TIMESTAMP- HOUR (CURRENT TIMESTAMP) HOURS
- MINUTE(CURRENT TIMESTAMP) MINUTES- SECOND(CURRENT TIMESTAMP) SECONDS- MICROSECOND(CURRENT TIMESTAMP) MICROSECONDS) + 1 DAY)
and SOURCE_SYS='CSS' and ONLINE_BATCH_IND IN('Y','E') AND APPL_PROCESS_IND = 'N' with UR]]></db:parameterized-query>
</db:select>
</foreach>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</batch:input>
<batch:process-records>
<batch:step name="Batch_Step">
<component class="com.mule.object.transformer.Mapper" doc:name="Java"/>
<dw:transform-message metadata:id="9bd2e755-065a-4208-95cf-1277f5643ee9" doc:name="Transform Message">
<dw:input-payload mimeType="application/java"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/csv separator = "|" , header = false , ignoreEmptyLine = true
---
[{
Timestamp: payload.timeStamp,
NotificationType: payload.notificationType,
UID: payload.UID,
Name: payload.messageData.firstName,
MiddleName: payload.messageData.middleName,
LastName: payload.messageData.lastName,
Email: payload.messageData.email,
HHNumber: payload.messageData.cssDataRequest.householdNumber,
PolicyNumber: payload.messageData.cssDataRequest.policyContractNumber,
SentDate: payload.messageData.cssDataRequest.sendDate,
PinNumber: payload.messageData.cssDataRequest.pin,
AOR: payload.messageData.cssDataRequest.agentOfRecord
}]]]></dw:set-payload>
</dw:transform-message>
<file:outbound-endpoint path="C:\opt\CCM\Output\IUT" connector-ref="File" responseTimeout="10000" doc:name="File"/>
</batch:step>
</batch:process-records>
<batch:on-complete>
<logger message="Batch2 Completed" level="INFO" doc:name="Logger"/>
</batch:on-complete>
</batch:job>
</mule>