I am using this Spring Boot Apache Camel version
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
Very simple scenario, I am trying to copy files from one folder to another. In ideal case (no timeout given), route should wait indefinitely for file to come in source folder. Once file comes, it should pick it and again loop and wait for next. Its working with Camel2.2 but not with latest one.
Code:
from("timer:theTimer?period=10s")
.log("Timer Invoked . . . ")
.pollEnrich("file:data/input?delete=true&readLock=none")
.log("BODY = [ ${body} ] " )
.to("file:data/output");
Any Camel expert suggestions?
Outcome, I had 2 files in input directory.
Output with camel2.2:
INFO 9248 --- [imer://theTimer] route1 : Timer Invoked . . .
INFO 9248 --- [imer://theTimer] route1 : BODY = [ FIle1 content ]
INFO 9248 --- [imer://theTimer] route1 : Timer Invoked . . .
INFO 9248 --- [imer://theTimer] route1 : BODY = [ File2 content ]
INFO 9248 --- [imer://theTimer] route1 : Timer Invoked . . .
<<Now it waiting for file and not doing anything>> ALL GOOD
Output with camel3.4 springboot: [ERROR ONCE input DIR IS EMPTY]
INFO 13864 --- [imer://theTimer] route1 : Timer Invoked . . .
INFO 13864 --- [imer://theTimer] route1 : BODY = [ FIle1 content ]
INFO 13864 --- [imer://theTimer] route1 : Timer Invoked . . .
INFO 13864 --- [imer://theTimer] route1 : BODY = [ File2 content ]
INFO 13864 --- [imer://theTimer] route1 : Timer Invoked . . .
INFO 13864 --- [imer://theTimer] route1 : BODY = [ ]
2020-07-20 14:23:33.293 ERROR 13864 --- [imer://theTimer] o.a.c.p.e.DefaultErrorHandler : Failed delivery for (MessageId: ID-OUDQ5TZO1R-1595235193339-0-3 on ExchangeId: ID-OUDQ5TZO1R-1595235193339-0-3). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot write null body to file: data\output\ID-OUDQ5TZO1R-1595235193339-0-3
Try to set allowNullBody to true on the endpoint.