使用MS SQL,当我的查询运行并命中数据库时,我有两个问题:
- 每一行都是单独的消息
- 当我只有~280项要选择
时,查询将无限次地运行不清楚我需要添加或省略的内容。
由于
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.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">
<jdbc-ee:mssql-data-source name="Dev_MS_SQL_Data_Source" user="XX" password="XXXXX" url="jdbc:sqlserver://SQLDEV;databaseName=theData" transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source"/>
<jdbc-ee:connector name="Database" dataSource-ref="Dev_MS_SQL_Data_Source" transactionPerMessage="false" validateConnections="true" queryTimeout="-1" pollingFrequency="100000" doc:name="Database"/>
<file:connector name="Ref_File_Out" autoDelete="false" outputAppend="true" streaming="true" validateConnections="true" doc:name="File"/>
<flow name="SimpleProjFlow1" doc:name="SimpleProjFlow1">
<jdbc-ee:inbound-endpoint queryKey="Test__query" queryTimeout="-1" pollingFrequency="1000" connector-ref="Database" doc:name="Database">
<jdbc-ee:query key="Test__query" value="select ROW_ID, ORDER_NO2, ORDER_NO4 from ShipConfirm"/>
<!--jdbc-ee:transaction action="ALWAYS_BEGIN"/-->
</jdbc-ee:inbound-endpoint>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<logger message="Message = #[message:payload]" level="INFO" doc:name="Logger"/>
<file:outbound-endpoint path="\\blat\Dummy" outputPattern="SimpleDBTest__#[function:datestamp:dd-MM-yyyy_HHmm].dat" responseTimeout="10000" connector-ref="Ref_File_Out" doc:name="File"/>
</flow>
</mule>
答案 0 :(得分:1)
您需要将ack
查询与选择的查询相关联,以便Mule可以标记已处理的记录,例如通过将标记设置为true
,同时确保选择查询仅选择记录带有false
的旗帜。请参阅:http://www.mulesoft.org/documentation/display/current/JDBC+Transport+Reference#JDBCTransportReference-Acknowledgment
要接收单条消息中的所有记录,请处理入站端点并将transactionPerMessage
设置为true
。