You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Kasim Sert (Ibtech-Software Infrastructure)" <ka...@ibtech.com.tr> on 2016/03/25 13:53:32 UTC

Camel reading file periodically

Hi,

Why this route reads file for only one time, and what should I do to make it work like excpected ?

                        from("timer://myTimer?period=1000")
                             .log("starting...")
                            .pollEnrich("file:d:/Workspaces/camel/demo-camel/src/main/resources?fileName=sample.xml&noop=true&readLock=none",1000)
                            .log("read message xml ${body}" );


Prints:

2016-03-25 14:45:21,274 [timer://myTimer] INFO  route1                         - starting...
2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - read message xml
2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - starting...
2016-03-25 14:45:22,299 [timer://myTimer] INFO  route1                         - read message xml <?xml version="1.0" encoding="UTF-8"?>
2016-03-25 14:45:23,288 [timer://myTimer] INFO  route1                         - starting...
2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - read message xml
2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - starting...
2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - read message xml
2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - starting...
2016-03-25 14:45:26,291 [timer://myTimer] INFO  route1                         - read message xml


[Facebook]<http://www.facebook.com/Finansbank>  [Twitter] <http://twitter.com/finansbank>

[https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=25.03.201614:5300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?date=25.03.201614:5300>


Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir. Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini i?ermeyebilir.

The information contained in this e-mail (including any attachments)is confidential. It must not be disclosed to any person without our authority. If you are not the intended recipient, please delete it from your system immediately. IBTech A.S. makes no warranty as to the accuracy or completeness of any information contained in this message and hereby excludes any liability of any kind for the information contained therein or for the information transmission, reception, storage or use of such in any way whatsoever. Any opinions expressed in this message are those of the author and may not necessarily reflect the opinions of IBTech A.S.

RE: Camel reading file periodically

Posted by "Kasim Sert (Ibtech-Software Infrastructure)" <ka...@ibtech.com.tr>.
Thank you, now working.

-----Original Message-----
From: benny.gi456@gmail.com [mailto:benny.gi456@gmail.com] 
Sent: Friday, March 25, 2016 3:20 PM
To: users@camel.apache.org
Subject: Re: Camel reading file periodically


Hi, 

With Noop=true, Camel will set idempotent=true as well, to avoid consuming the same files over and over again.
So just set idempotent to false.

http://camel.apache.org/file2.html

Regards,

Benjamin Girstl


> Am 25.03.2016 um 13:53 schrieb Kasim Sert (Ibtech-Software Infrastructure) <ka...@ibtech.com.tr>:
> 
> Hi,
> 
> Why this route reads file for only one time, and what should I do to make it work like excpected ?
> 
>                        from("timer://myTimer?period=1000")
>                             .log("starting...")
>                            .pollEnrich("file:d:/Workspaces/camel/demo-camel/src/main/resources?fileName=sample.xml&noop=true&readLock=none",1000)
>                            .log("read message xml ${body}" );
> 
> 
> Prints:
> 
> 2016-03-25 14:45:21,274 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:22,299 [timer://myTimer] INFO  route1                         - read message xml <?xml version="1.0" encoding="UTF-8"?>
> 2016-03-25 14:45:23,288 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:26,291 [timer://myTimer] INFO  route1                         - read message xml
> 
> 
> [Facebook]<http://www.facebook.com/Finansbank>  [Twitter] <http://twitter.com/finansbank>
> 
> [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=25.03.201614:5300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?date=25.03.201614:5300>
> 
> 
> Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir. Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini i?ermeyebilir.
> 
> The information contained in this e-mail (including any attachments)is confidential. It must not be disclosed to any person without our authority. If you are not the intended recipient, please delete it from your system immediately. IBTech A.S. makes no warranty as to the accuracy or completeness of any information contained in this message and hereby excludes any liability of any kind for the information contained therein or for the information transmission, reception, storage or use of such in any way whatsoever. Any opinions expressed in this message are those of the author and may not necessarily reflect the opinions of IBTech A.S.


Bu e-posta'nin i?erdigi bilgiler (ekleri dahil olmak 
?zere) gizlidir. Onayimiz olmaksizin ???nc? kisilere a?iklanamaz. Bu mesajin 
g?nderilmek istendigi kisi degilseniz, l?tfen mesaji sisteminizden derhal 
siliniz. IBTech A.S. bu mesajin i?erdigi bilgilerin dogrulugu veya eksiksiz 
oldugu konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne sekilde 
olursa olsun i?eriginden, iletilmesinden, alinmasindan, saklanmasindan sorumlu 
degildir. Bu mesajin i?erigi yazarina ait olup, IBTech A.S.'nin g?r?slerini 
i?ermeyebilir.

The information contained in this e-mail (including any 
attachments)is confidential. It must not be disclosed to any person without our 
authority. If you are not the intended recipient, please delete it from your 
system immediately. IBTech A.S. makes no warranty as to the accuracy or 
completeness of any information contained in this message and hereby excludes 
any liability of any kind for the information contained therein or for the 
information transmission, reception, storage or use of such in any way 
whatsoever. Any opinions expressed in this message are those of the author and 
may not necessarily reflect the opinions of IBTech 
A.S.

Re: Camel reading file periodically

Posted by be...@gmail.com.
Hi, 

With Noop=true, Camel will set idempotent=true as well, to avoid consuming the same files over and over again.
So just set idempotent to false.

http://camel.apache.org/file2.html

Regards,

Benjamin Girstl


> Am 25.03.2016 um 13:53 schrieb Kasim Sert (Ibtech-Software Infrastructure) <ka...@ibtech.com.tr>:
> 
> Hi,
> 
> Why this route reads file for only one time, and what should I do to make it work like excpected ?
> 
>                        from("timer://myTimer?period=1000")
>                             .log("starting...")
>                            .pollEnrich("file:d:/Workspaces/camel/demo-camel/src/main/resources?fileName=sample.xml&noop=true&readLock=none",1000)
>                            .log("read message xml ${body}" );
> 
> 
> Prints:
> 
> 2016-03-25 14:45:21,274 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:22,299 [timer://myTimer] INFO  route1                         - read message xml <?xml version="1.0" encoding="UTF-8"?>
> 2016-03-25 14:45:23,288 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:26,291 [timer://myTimer] INFO  route1                         - read message xml
> 
> 
> [Facebook]<http://www.facebook.com/Finansbank>  [Twitter] <http://twitter.com/finansbank>
> 
> [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=25.03.201614:5300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?date=25.03.201614:5300>
> 
> 
> Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir. Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini i?ermeyebilir.
> 
> The information contained in this e-mail (including any attachments)is confidential. It must not be disclosed to any person without our authority. If you are not the intended recipient, please delete it from your system immediately. IBTech A.S. makes no warranty as to the accuracy or completeness of any information contained in this message and hereby excludes any liability of any kind for the information contained therein or for the information transmission, reception, storage or use of such in any way whatsoever. Any opinions expressed in this message are those of the author and may not necessarily reflect the opinions of IBTech A.S.

Re: Camel reading file periodically

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

It only reads the file the 1st time, the other times the pollEnrich
cannot find any new file, and it timeout after 1 second, and the Camel
route continue, where you then log an empty message.

If you want to pickup files from a directory, then its better to start
from file instead of using a timer


from file
  log i have a file


Then the route will only trigger if there is a file





On Fri, Mar 25, 2016 at 1:53 PM, Kasim Sert (Ibtech-Software
Infrastructure) <ka...@ibtech.com.tr> wrote:
> Hi,
>
> Why this route reads file for only one time, and what should I do to make it work like excpected ?
>
>                         from("timer://myTimer?period=1000")
>                              .log("starting...")
>                             .pollEnrich("file:d:/Workspaces/camel/demo-camel/src/main/resources?fileName=sample.xml&noop=true&readLock=none",1000)
>                             .log("read message xml ${body}" );
>
>
> Prints:
>
> 2016-03-25 14:45:21,274 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:22,287 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:22,299 [timer://myTimer] INFO  route1                         - read message xml <?xml version="1.0" encoding="UTF-8"?>
> 2016-03-25 14:45:23,288 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:24,289 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - read message xml
> 2016-03-25 14:45:25,290 [timer://myTimer] INFO  route1                         - starting...
> 2016-03-25 14:45:26,291 [timer://myTimer] INFO  route1                         - read message xml
>
>
> [Facebook]<http://www.facebook.com/Finansbank>  [Twitter] <http://twitter.com/finansbank>
>
> [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=25.03.201614:5300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?date=25.03.201614:5300>
>
>
> Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir. Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini i?ermeyebilir.
>
> The information contained in this e-mail (including any attachments)is confidential. It must not be disclosed to any person without our authority. If you are not the intended recipient, please delete it from your system immediately. IBTech A.S. makes no warranty as to the accuracy or completeness of any information contained in this message and hereby excludes any liability of any kind for the information contained therein or for the information transmission, reception, storage or use of such in any way whatsoever. Any opinions expressed in this message are those of the author and may not necessarily reflect the opinions of IBTech A.S.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2