如何让 Mule 从 JDBC 查询中作为单个事务返回多行?

2024-05-04

如果 Oracle 表中有 100 行,我希望收到一封正文有 100 行的电子邮件,但我收到了 100 封电子邮件,每行一封......我认为 transactionPerMessage 会做到这一点(工具提示说,“如果false,整个结果集将有一个事务”),但无论我将其设置为 true 还是 false 都没有什么区别。

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

<mule xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc" 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" version="CE-3.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd 
http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/current/mule-jdbc.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/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
    <jdbc:oracle-data-source name="Oracle_Data_Source" user="test" password="test" url="jdbc:oracle:thin:@//ora:1530/TEST.EXAMPLE.COM" transactionIsolation="UNSPECIFIED" doc:name="Oracle Data Source"/>
    <jdbc:connector name="Database" dataSource-ref="Oracle_Data_Source" validateConnections="true" transactionPerMessage="false" queryTimeout="-1" pollingFrequency="5000" doc:name="Database"/>
    <flow name="Ross_invoice_Workflow2Flow1" doc:name="Ross_invoice_Workflow2Flow1">
        <jdbc:inbound-endpoint queryKey="GetUnprocessedInvoices" queryTimeout="-1" pollingFrequency="1000" connector-ref="Database" doc:name="Database">
            <jdbc:query key="GetUnprocessedInvoices" value="SELECT        INVOICE_NUMBER FROM            FIN.LHF_INVOICE_WORKFLOW&#13;&#10;WHERE        (STATUS_FLAG = 'N')"/>
        </jdbc:inbound-endpoint>
        <echo-component doc:name="Echo"/>
        <smtp:outbound-endpoint host="mail.example.com" to="[email protected] /cdn-cgi/l/email-protection" from="[email protected] /cdn-cgi/l/email-protection" subject="invoice test" responseTimeout="10000" doc:name="SMTP"/>
    </flow>
</mule>

让 Mule 像现在一样每行创建一条消息,然后使用聚合器将消息按 100 进行分组。您还必须在聚合器上为最后一组配置超时,该超时可能不会达到 100(除非您的消息数量)记录始终是 100 的倍数)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何让 Mule 从 JDBC 查询中作为单个事务返回多行? 的相关文章

随机推荐