Hi everyone,

Use case: download file from FTP, split (stream mode) and process each of
them. I need to produce file with only error occurred during processing.

This is route to manage Report Builder:
<route>
<from uri="direct:appendToReport" />
                        
                        <onCompletion>
                                <onWhen>
                                        <simple>${in.header.CamelSplitComplete} 
== 'true'</simple>
                                </onWhen>
                                <log message="On Completion: moving
ERR_${file:name.noext}-${in.header.ImportDateTime}.csv in Ready." />
                                <setHeader headerName="MoveURI">
                                
<simple>{{local.work.directory.report.log}}?fileName=ERR_${file:name.noext}-${in.header.ImportDateTime}.csv&amp;fileExist=Move&amp;moveExisting=Ready</simple>
                                </setHeader>
                                
<recipientList><header>MoveURI</header></recipientList>
                        </onCompletion>
                        
                        <log message="ReportBuilder_FileAppender_Route receiving
${in.header.CamelSplitIndex}/${in.header.CamelSplitComplete}/${in.header.Result}"
/>
                        <choice>
                                <when>
                                        <simple>${in.header.Result} == 'ERROR' 
|| ${in.header.Result} ==
'FAILURE' || ${in.header.Result} == 'SKIPPED'</simple>
                                        <marshal ref="LoggerDataFormat" />
                                                
                                        <setHeader headerName="OutputUriReport">
                                        
<simple>{{local.work.directory.report.log}}?fileName=ERR_${file:name.noext}-${in.header.ImportDateTime}.csv&amp;fileExist=Append</simple>
                                        </setHeader>
                                        <log 
message="ReportBuilder_FileAppender_Route append discarded row:
${in.header.OutputUriReport}" />
                                        <recipientList>
                                                <header>OutputUriReport</header>
                                        </recipientList>
                                </when>
                        </choice>
</route>
At the end of the process, I have a complete error report log in Ready
folder and another file with single row related to last of main file
processed in localWork report log Dir.

I tried with TryRename but when received last result it override all.

How to avoid writing of last single row?

Any idea?

Thanks in advance.

Best regards

Michele



--
View this message in context: 
http://camel.465427.n5.nabble.com/File-Issue-Append-and-Move-file-on-completion-whole-process-tp5785634.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to