0

如果我在 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="test@example.com" from="mule@example.com" subject="invoice test" responseTimeout="10000" doc:name="SMTP"/>
    </flow>
</mule>
4

2 回答 2

1

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

于 2012-12-05T00:13:59.747 回答
0

如果您还在端点上将 transactionPerMessage 属性设置为“true”并添加如下事务,则在连接器上将 transactionPerMessage 设置为“false”应该可以工作:

<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:transaction action="ALWAYS_BEGIN"/>
    <property key="receiveMessageInTransaction" value="true"/>
</jdbc:inbound-endpoint>
于 2013-04-09T19:37:38.680 回答