骆驼路线在OnCompletion死亡,没有任何迹象表明原因

时间:2016-08-05 14:56:50

标签: java apache-camel

我有以下路线和一个oncompletion部分。当路由中较早出现错误(由文件中的错误数据引起)时,camel不会在oncompletion中运行所有步骤。它似乎运行第一个,就是这样。所以在下面的路线中,步骤被调用然后骆驼停止。如果我取出日志,则调用sendCompletionEmail()并停止。

如果没有数据错误,则运行oncompletion中的所有步骤,并发送电子邮件。我错过了什么?当有数据错误时,Camel正在进行oncompletion。为什么所有步骤都没有运行?

<route id="spreadsheetMilRouteDirect">
    <from uri="direct:csvRouteDirectFile" />
        <onException>
            <exception>java.lang.IllegalArgumentException</exception>
            <redeliveryPolicy maximumRedeliveries="1" />
            <handled>
                <constant>true</constant>
             </handled>
            <transform>
                <simple>Failed to process record of file - ${header.CamelFileNameOnly} \n\n Reason - ${exception.message}  \n\n Position in file - ${header.CamelSplitIndex} \n\n Record - |${in.body}| \n\n ${exception.stacktrace}</simple>                       
            </transform>
            <to uri="bean:ExternalBAImpl?method=setUnknown" />  
            <to uri="log:java.lang.IllegalArgumentException"></to>
            <to uri="smtp://mail1.us.com?to=c@tra.com&amp;from=DEV@tra.com&amp;subject=MFC File Processing - Exception - Failed to process a record of the csv file due to IllegalArgumentException" />
        </onException> 
        <onException>
            <exception>java.text.ParseException</exception>
            <redeliveryPolicy maximumRedeliveries="1" />
            <handled>
                <constant>true</constant>
             </handled>
            <to uri="bean:ExternalBAImpl?method=setUnknown" />  
            <to uri="log:java.text.ParseException"></to>
            <transform>
                    <simple>Failed to process record of file - ${header.CamelFileNameOnly} \n\n Reason - ${exception.message}  \n\n Position in file - ${header.CamelSplitIndex} \n\n Record - ${in.body} \n\n ${exception.stacktrace}</simple>                         
                </transform>
            <to uri="smtp://mail1.us.com?to=c@tra.com&amp;from=DEV@tra.com&amp;subject=MFC File Processing - Exception - Failed to process a record of the csv file due to ParseException" />
        </onException> 
        <onException>
            <exception>java.io.FileNotFoundException</exception>
            <redeliveryPolicy maximumRedeliveries="12"  redeliveryDelay="5000" retryAttemptedLogLevel="WARN"/>
            <handled>
                <constant>true</constant>
             </handled>
            <to uri="log:java.io.FileNotFoundException"></to>
            <transform>
                    <simple>Failed to process ${header.CamelFileNameOnly} \n\n Reason - ${exception.message}  \n\n ${exception.stacktrace}</simple>                         
                </transform>
            <to uri="smtp://mail1.us.com?to=c@tra.com&amp;from=DEV@tra.com&amp;subject=MFC File Processing - Exception - Failed to process of the csv file due to FileNotFoundException" />
        </onException> 
        <onException>
            <exception>java.lang.Exception</exception>
            <handled>
                <constant>true</constant>
             </handled>
            <to uri="log:java.lang.Exception"></to>
            <transform>
                    <simple>Failure while processing ${header.CamelFileNameOnly} \n\n Reason - ${exception.message}  \n\n ${exception.stacktrace}</simple>                      
                </transform>
            <to uri="smtp://mail1.us.com?to=c@tra.com&amp;from=DEV@tra.com&amp;subject=MFC File Processing - Exception - Failed to process of the csv file due to Exception" />
        </onException> 
        <split parallelProcessing="false" strategyRef="exchangePropertiesAggregatorStrategy" >
            <tokenize token="\r\n"/>
            <choice>
                <when>
                    <simple>${in.body} regex '^FD_DESC_CD.*'</simple>
                    <to uri="stub:bean:ExternalBAImpl?method=setFileHeader" />  
                </when>
                    <when>
                    <simple>${in.body} regex '^,*$'</simple>
                    <aggregate  strategyRef="aggregatorStrategy" forceCompletionOnStop="true" completionTimeout="3000">
                         <correlationExpression>
                            <constant>true</constant>
                        </correlationExpression>
                        <transform>
                            <simple>Skipped records in file - ${header.CamelFileNameOnly} \n\n Reason - Blank Records ',,,,'.  ${header.CamelAggregatedSize} blank found. </simple>                         
                        </transform>
                        <to uri="smtp://mail1.us.com?to=c@tra.com&amp;from=DEV@tra.com&amp;subject=MFC File Processing - Exception - Blank records not processd"/>
                    </aggregate>
                </when>
                <otherwise>
                    <when>
                        <simple>${file:name} regex 'manual.*.csv'</simple>
                        <unmarshal ref="csv.navcsv.format"/>
                        <to uri="bean:ExternalBAImpl?method=setRate" />
                    </when>
                </otherwise>
            </choice>               
        </split>
      <onCompletion>
            <to uri="log:completion" /> 
            <to uri="bean:ExternalBAImpl?method=sendCompletionEmail" />
            <log message="LOG STEP 2" loggingLevel="INFO" logName="com.mycompany.MyCoolRoute"/>
            <transform>
                <simple>${property[completionEmailMessage]}</simple>
            </transform>
            <log message="LOG STEP 3" loggingLevel="INFO" logName="com.mycompany.MyCoolRoute"/>
            <choice>
                <when>
                    <simple>${property[completionStatusMessage]} == 'Success'</simple>
                    <to uri="smtp://mail1.us.aegon.com?contentType=text/html&amp;to=chris.hankey@transamerica.com&amp;from=MFCDEV@transamerica.com&amp;subject=MFC File Processing Status - CSV - Success" />
                </when>
                <otherwise>
                    <to uri="smtp://mail1.us.aegon.com?contentType=text/html&amp;to=chris.hankey@transamerica.com&amp;from=MFCDEV@transamerica.com&amp;subject=MFC File Processing Status - CSV - Error" />
                </otherwise>
            </choice>
        </onCompletion>
</route>

0 个答案:

没有答案