~ / archivo / stackoverflow / 44370302
How to use Camel Apache Timer Component
StackOverflow
· java, timer, apache-camel
· ayudé
respuesta aceptada
-
J Kait pregunta 2017-06-05 13:39
So currently, the only thing that we can work out is to simply transfer one file to another folder. Like so:
from("file://C:/Users/Me/Desktop/FolderA?noop=true") .to("file://C:/Users/Me/Desktop/FolderB");However, when I try to add the complexity of the timer component, it just does not make sense to me. I keep getting "Cannot write null body to file" exception.
The code I try to write for the timer Component is like so:
from("timer://file://C:/Users/Me/Desktop/FolderA?period=30000") .to("file://C:/Users/Me/Desktop/FolderB");- Sami Nurminen 2017-06-21 18:11 camel.apache.org/file2.html has options for polling file. It polls folders.
-
Have you tried:
from("timer://file://C:/Users/Me/Desktop/FolderA?fixedRate=true&period=30s") .to("file://C:/Users/Me/Desktop/FolderB");And instead of using "30000" you could use "30s" which is more friendly to read.
Check this out.
-
kswaughs respuesta 2017-06-05 14:02
Use timer with pollEnrich
from("timer://foo?period=30000") .pollEnrich("file://C:/Users/Me/Desktop/FolderA?noop=true") .to("file://C:/Users/Me/Desktop/FolderB");