Saltar al contenido

~ / archivo / stackoverflow / 44370302

How to use Camel Apache Timer Component

StackOverflow · java, timer, apache-camel · ayudé respuesta aceptada
  1. 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");
    
  2. Miguel Ortiz yo respuesta aceptada +1 2017-06-05 13:53

    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.

  3. 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");
    

← todos los hilos de StackOverflow