Mule中的多个集合聚合器导致路由混淆

Mule中的多个集合聚合器导致路由混淆,mule,Mule,因此,我尝试使用Choice Flow控件根据数据库中的字段发送发票。这在不使用收集聚合器的情况下运行良好,但是我想使用聚合器将事务分组到单个电子邮件中。但是,当我添加集合聚合器时,路由会变得混乱。例如,在我的上一次测试中,使用LHF_invoice_METHOD='INACTV'和IS_ZERO_或_NEGATIVE='1'的发票被路由到“卡车运输”(它正确路由到“非活动”而不进行集合聚合)。我认为收集聚合器导致路线相互交叉。我将MULE\u CORRELATION\u ID设置为包含LHF\

因此,我尝试使用Choice Flow控件根据数据库中的字段发送发票。这在不使用收集聚合器的情况下运行良好,但是我想使用聚合器将事务分组到单个电子邮件中。但是,当我添加集合聚合器时,路由会变得混乱。例如,在我的上一次测试中,使用LHF_invoice_METHOD='INACTV'和IS_ZERO_或_NEGATIVE='1'的发票被路由到“卡车运输”(它正确路由到“非活动”而不进行集合聚合)。我认为收集聚合器导致路线相互交叉。我将MULE\u CORRELATION\u ID设置为包含LHF\u INVOICE\u方法,并且为零或负,因此集合聚合器有自己的相关ID

<flow name="InvoiceWorkflow" doc:name="InvoiceWorkflow" processingStrategy= "synchronous">
    <jdbc:inbound-endpoint queryKey="GetUnprocessedInvoices" queryTimeout="10000" pollingFrequency= "1000" connector-ref ="Database" doc:name="Get invoice run" >
        <jdbc:query key="GetUnprocessedInvoices" value="SELECT        COMPANY_CODE, DIVISION, INVOICE_NUMBER,&#13;&#10;LHF_INVOICE_METHOD, STATUS_FLAG,&#13;&#10;SYSTEM_DATE, USERNAME, RUN_NUMBER, ROWID, IS_ZERO_OR_NEGATIVE,&#13;&#10;LHF_INVOICE_METHOD || RUN_NUMBER || IS_ZERO_OR_NEGATIVE AS CORRELATION_ID,&#13;&#10;LHF_INVOICE_METHOD || RUN_NUMBER || IS_ZERO_OR_NEGATIVE || '2' AS CORRELATION_ID_2&#13;&#10;FROM             FIN.LHF_INVOICE_WORKFLOW &#13;&#10; WHERE         (STATUS_FLAG = 'N')"/>
    </jdbc:inbound-endpoint>
    <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="insert_invoice_run" queryTimeout= "10000" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name= "Load to custom_app_data">
        <jdbc:query key="insert_invoice_run" value="INSERT INTO lhf_ros_invoice_workflow ([COMPANY_CODE] ,[DIVISION] ,[INVOICE_NUMBER] ,[LHF_INVOICE_METHOD] ,[STATUS_FLAG] ,[SYSTEM_DATE] ,[USERNAME] ,[RUN_NUMBER] ,[IS_ZERO_OR_NEGATIVE]) VALUES (#[map-payload:COMPANY_CODE] ,#[map-payload:DIVISION] ,#[map-payload:INVOICE_NUMBER] ,#[map-payload:LHF_INVOICE_METHOD], #[map-payload:STATUS_FLAG] ,#[map-payload:SYSTEM_DATE] ,#[map-payload:USERNAME] ,#[map-payload:RUN_NUMBER] ,#[map-payload:IS_ZERO_OR_NEGATIVE])"/>
    </jdbc:outbound-endpoint>
    <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MarkAsProcessed" queryTimeout= "10000" connector-ref="DatabaseMuleLogin" doc:name= "Mark Processed in Ross" >
        <jdbc:query key="MarkAsProcessed" value="UPDATE       FIN.LHF_INVOICE_WORKFLOW SET                 STATUS_FLAG = 'P' WHERE        (ROWID = #[map-payload:ROWID])"/>
    </jdbc:outbound-endpoint>
    <message-properties-transformer doc:name="Message Properties">
        <add-message-property key="MULE_CORRELATION_GROUP_SIZE" value="1000"/>
        <add-message-property key="MULE_CORRELATION_ID" value="#[message.payload.CORRELATION_ID]"/>
    </message-properties-transformer>
    <choice doc:name="Choice" >
        <when expression="#[message.payload.LHF_INVOICE_METHOD == 'INACTV']">
            <processor-chain>
                <collection-aggregator failOnTimeout="false" doc:name="Inactive" timeout="2000"/>
                <smtp:outbound-endpoint  responseTimeout="10000" doc:name="Inactive" from="muleservice@example.com"  subject="[Invoice Workflow] Inactive 1" to="ben@example.com" host="mail.example.com"/>
                <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
            </processor-chain>
        </when>
        <when expression="#[message.payload.IS_ZERO_OR_NEGATIVE=='1']">
            <processor-chain>
                <collection-aggregator timeout="3000" failOnTimeout="false" doc:name="Zero"/>
                <smtp:outbound-endpoint to= "ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] Zero Dollar " responseTimeout= "10000"  doc:name="Zero Dollar" host="mail.example.com"/>
                <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
            </processor-chain>
        </when>
        <when expression="#[message.payload.LHF_INVOICE_METHOD=='TRUCK']">
            <processor-chain>
                <collection-aggregator timeout="4000" failOnTimeout="false" doc:name="Truck"/>
                <smtp:outbound-endpoint to= "ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] Trucking" responseTimeout= "10000"  doc:name="Trucking" host="mail.example.com"/>
                <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
            </processor-chain>
        </when>
        <otherwise>
            <processor-chain>
                <smtp:outbound-endpoint host="mail.example.com" to="ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] RSForms Email" responseTimeout="10000" doc:name="RSForms"/>
                <message-properties-transformer overwrite="true" doc:name="Message Properties">
                    <add-message-property key="MULE_CORRELATION_ID" value="#[message.payload.CORRELATION_ID_2]"/>
                </message-properties-transformer>
                <choice doc:name="Choice">
                    <when expression="#[message.payload.LHF_INVOICE_METHOD == 'SPEC']">
                        <processor-chain>
                            <collection-aggregator timeout="5000" failOnTimeout="false" doc:name="Special"/>
                            <smtp:outbound-endpoint host="mail.example.com" to="ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] Special Handling" responseTimeout="10000" doc:name="Special"/>
                            <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
                        </processor-chain>
                    </when>
                    <when expression="#[message.payload.LHF_INVOICE_METHOD == 'EMAIL']">
                        <processor-chain>
                            <collection-aggregator timeout="6000" failOnTimeout="false" doc:name="Do Nothing"/>
                            <smtp:outbound-endpoint host="mail.example.com" to="ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] Do nothing" responseTimeout="10000" doc:name="Do Nothing"/>
                            <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
                        </processor-chain>
                    </when>
                    <when expression="#[message.payload.LHF_INVOICE_METHOD == 'MAILUS']">
                        <processor-chain>
                            <collection-aggregator timeout="7000" failOnTimeout="false" doc:name="US Mail"/>
                            <smtp:outbound-endpoint host="mail.example.com" to="ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] US Mail" responseTimeout="10000" doc:name="US Mail"/>
                            <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
                        </processor-chain>
                    </when>
                    <when expression="#[message.payload.LHF_INVOICE_METHOD == 'MAILCN']">
                        <processor-chain>
                            <collection-aggregator timeout="8000" failOnTimeout="false" doc:name="Intl Mail"/>
                            <smtp:outbound-endpoint host="mail.example.com" to="ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] Intl Mail" responseTimeout="10000" doc:name="Intl Mail"/>
                            <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
                        </processor-chain>
                    </when>
                    <when expression="#[message.payload.LHF_INVOICE_METHOD == 'EDI']">
                        <processor-chain>
                            <collection-aggregator timeout="9000" failOnTimeout="false" doc:name="EDI"/>
                            <smtp:outbound-endpoint host="mail.example.com" to="ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] EDI" responseTimeout="10000" doc:name="EDI"/>
                            <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
                        </processor-chain>
                    </when>
                    <otherwise>
                        <processor-chain>
                            <collection-aggregator timeout="10000" failOnTimeout="false" doc:name="Exceptions"/>
                            <smtp:outbound-endpoint host="mail.example.com" to="ben@example.com" from="muleservice@example.com" subject="[Invoice Workflow] Exceptions" responseTimeout="10000" doc:name="Exceptions"/>
                            <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
                        </processor-chain>
                    </otherwise>
                </choice>
            </processor-chain>
        </otherwise>
    </choice>
</flow >

我在聚合器之前的每个WHEN分支之后添加了记录器,并且事务在聚合之前转到正确的分支。这里是实际数据,据我所知,Mule关联ID对于每个聚合器都是唯一的。下面是一些实际发送的数据,包括发生的事情和我的预期:

聚合前(全部正确)

记录器处于非活动状态

{发票编号=408908,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=INACTV,运行编号=4862651810,ROWID=oracle.sql。ROWID@5a72f4f7,公司代码=1,状态标志=N,用户名=BBRYAN,相关性ID=INATV48626518101,相关性ID=INATV486265181012,为零或负=1}

{发票编号=406749,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=INACTV,运行编号=4862651810,ROWID=oracle.sql。ROWID@c0a628c,公司代码=1,状态标志=N,用户名=BBRYAN,相关性ID=INATV48626518101,相关性ID=INATV486265181012,为零或负=1}

{发票编号=408691,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=INACTV,运行编号=4862651810,ROWID=oracle.sql。ROWID@42652ecc,公司代码=1,状态标志=N,用户名=BBRYAN,相关性ID=INACTV48626518100,相关性ID=INACTV486265181002,为零或负=0}

零或负的记录器

{发票编号=409061,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=MAILUS,运行编号=4862651810,ROWID=oracle.sql。ROWID@7933b36f,公司代码=1,状态标志=N,用户名=BBRYAN,相关性ID=MAILUS48626518101,相关性ID=MAILUS486265181012,为零或负=1}

{发票编号=410968,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=EDI,运行编号=4862651810,行ID=oracle.sql。ROWID@7a9b36be,公司代码=1,状态标志=N,用户名=BBRYAN,关联ID=EDI48626518101,关联ID=EDI486265181012,为零或负=1}

聚合后的

非活动1:(这两个人去了正确的路线)

[{发票编号=408908,系统日期=2012-12-19 16:36:50.0,分区=1,LHF发票方法=INACTV,运行编号=4862651810,ROWID=oracle.sql。ROWID@5a72f4f7,公司代码=1,状态标志=N,用户名=BBRYAN,相关性ID=INATV48626518101,相关性ID=INATV486265181012,为零或负=1}

{发票编号=406749,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=INACTV,运行编号=4862651810,ROWID=oracle.sql。ROWID@c0a628c,公司代码=1,状态标志=N,用户名=BBRYAN,相关性ID=INACTV48626518101,相关性ID=INACTV486265181012,为零或负=1}]

零美元:(这个是正确的)

[{发票编号=409061,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=MAILUS,运行编号=4862651810,ROWID=oracle.sql。ROWID@7933b36f,公司代码=1,状态标志=N,用户名=BBRYAN,相关号=MAILUS48626518101,相关号=MAILUS486265181012,为0或负=1}]

卡车运输:(本应为零美元)

[{发票编号=410968,系统日期=2012-12-19 16:36:50.0,部门=1,LHF发票方法=EDI,运行编号=4862651810,行ID=oracle.sql。ROWID@7a9b36be,公司代码=1,状态标志=N,用户名=BBRYAN,相关性ID=EDI48626518101,相关性ID=EDI486265181012,为零或负=1}]

特殊处理:(应转到“非活动1”)

[{发票编号=408691,系统日期=2012-12-19 1
<when expression="#[message.payload.LHF_INVOICE_METHOD == 'INACTV']">
    <processor-chain>
        <collection-aggregator storePrefix="inactive" failOnTimeout="false" doc:name="Inactive" timeout="2000"/>
        <smtp:outbound-endpoint  responseTimeout="10000" doc:name="Inactive" from="muleservice@example.com"  subject="[Invoice Workflow] Inactive 1" to="ben@example.com" host="mail.example.com"/>
        <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="MARK_COMPLETE" queryTimeout="-1" connector-ref="SPTSQL01_APPS_custom_app_data" doc:name="Mark Complete"/>
    </processor-chain>
</when>