You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Avadhut Lele <ko...@gmail.com> on 2020/06/11 10:18:32 UTC
File/SFTP component: rename does not work in 'move' operation
Dear all,
I have a query regarding file/sftp components. If we are using sftp
component with pollEnrich, renaming file does not work in ‘move’
operation inside `pollEnrich().simple()`.
I am attaching sample reproducer along with this email. If any of you
get a chance to take a look, it would be great.
-------------------------------------------------------------------------------------------------------------------
from("timer:myTimerComponent?repeatCount=1")
.setProperty("FilePattern",
simple("EXAMPLE_FILE__${date:now:yyyyMMdd}_*.txt"))
.setProperty(EXCHPROP_NAME_DEST, simple("file:{{input.location}}?"
+ "?antInclude=${exchangeProperty.FilePattern}"
+
"&move={{archive.location}}/${file:onlyname}_${date:now:dd_MMM_yyyy_HH.mm.ss.SSS}"
+
"&moveFailed={{error.location}}/${file:onlyname}_${date:now:dd_MMM_yyyy_HH.mm.ss.SSS}"
+ "&recursive=true"))
.log("${body}")
// used for reading file from sftp/file
.loopDoWhile(body().isNotNull())
.pollEnrich()
// putting properties for sftp/file consumer endpoint
.simple("${exchangeProperty." + EXCHPROP_NAME_DEST + "}")
.timeout(1000)
.aggregationStrategy(pollEnrichStrategy)
.choice()
.when(body().isNotNull())
.to("log:mylogger").id("logProducer")
.endChoice()
.otherwise()
.end()
.end();
;
-------------------------------------------------------------------------------------------------------------------
I have few dynamic values in my application. However, above/attached
code is created for demonstration and I tried to put only a few
configs.
I am expecting filename ‘EXAMPLE_FILE__20200528_010004.txt’ should be
something like ‘EXAMPLE_FILE__20200528_010004.txt_09_JUN_2020_12.00.00.000’
based on current date time and it should be moved to archive folder.
Referring to documentation[1] and [2], code looks good. But, it does
not work as per expectations while renaming file inside ‘move’
operation.
[1] https://camel.apache.org/components/latest/file-component.html
[2] https://camel.apache.org/components/latest/languages/file-language.html
Signed,
Avadhut