You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Oliver Wulff <ow...@talend.com> on 2017/03/24 10:28:01 UTC

file input with tail -f behaviour

Hi there


I've tried to use the stream input component to listen on changes within a file to process the lines one by one.


<from uri="stream:file?fileName=sample.csv&amp;scanStream=true&amp;scanStreamDelay=1000&amp;retry=true" />


But I noticed it always starts from the beginning. Is there an option in Camel to have "tail -f" behaviour to trigger my route?


Thanks

Oli


Re: file input with tail -f behaviour

Posted by Claus Ibsen <cl...@gmail.com>.
Try with latest release also.

And yeah contributions is welcome. You can try improving that component.
http://camel.apache.org/contributing

On Tue, Mar 28, 2017 at 2:35 PM, Oliver Wulff <ow...@talend.com> wrote:
> Even when there is no change in the file it starts parsing it from the first line every second:
>
>
> <from uri="stream:file?fileName=sample.csv&amp;scanStream=true&amp;scanStreamDelay=1000&amp;retry=true" />
>
>
> I use Camel version 2.16.3.
>
>
> Maybe an option in Camel could be to use the Apache Commons IO Tailer implementation similar to Apache Karaf Decanter here:
>
> https://github.com/apache/karaf-decanter/blob/master/collector/file/src/main/java/org/apache/karaf/decanter/collector/file/DecanterTailerListener.java
>
>
> Thanks
>
> Oli
>
>
>
> ________________________________
> Von: Claus Ibsen <cl...@gmail.com>
> Gesendet: Montag, 27. März 2017 11:13:58
> An: users@camel.apache.org
> Betreff: Re: file input with tail -f behaviour
>
> What do you mean by start from beginning?
>
> It ought to read line by line when the file is appended. And if a new
> file is created it starts from top again.
> If you shutdown Camel, it does not remember where it was last time,
> and start all over again
>
> On Fri, Mar 24, 2017 at 11:28 AM, Oliver Wulff <ow...@talend.com> wrote:
>> Hi there
>>
>>
>> I've tried to use the stream input component to listen on changes within a file to process the lines one by one.
>>
>>
>> <from uri="stream:file?fileName=sample.csv&amp;scanStream=true&amp;scanStreamDelay=1000&amp;retry=true" />
>>
>>
>> But I noticed it always starts from the beginning. Is there an option in Camel to have "tail -f" behaviour to trigger my route?
>>
>>
>> Thanks
>>
>> Oli
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Claus Ibsen (@davsclaus) riding the Apache Camel<http://davsclaus.com/>
> davsclaus.com
> A blog about Apache Camel, by Claus Ibsen, the leading contributor, and author of the Camel in Action book.
>
>
>
> Camel in Action 2: https://www.manning.com/ibsen2



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

AW: file input with tail -f behaviour

Posted by Oliver Wulff <ow...@talend.com>.
Even when there is no change in the file it starts parsing it from the first line every second:


<from uri="stream:file?fileName=sample.csv&amp;scanStream=true&amp;scanStreamDelay=1000&amp;retry=true" />


I use Camel version 2.16.3.


Maybe an option in Camel could be to use the Apache Commons IO Tailer implementation similar to Apache Karaf Decanter here:

https://github.com/apache/karaf-decanter/blob/master/collector/file/src/main/java/org/apache/karaf/decanter/collector/file/DecanterTailerListener.java


Thanks

Oli



________________________________
Von: Claus Ibsen <cl...@gmail.com>
Gesendet: Montag, 27. März 2017 11:13:58
An: users@camel.apache.org
Betreff: Re: file input with tail -f behaviour

What do you mean by start from beginning?

It ought to read line by line when the file is appended. And if a new
file is created it starts from top again.
If you shutdown Camel, it does not remember where it was last time,
and start all over again

On Fri, Mar 24, 2017 at 11:28 AM, Oliver Wulff <ow...@talend.com> wrote:
> Hi there
>
>
> I've tried to use the stream input component to listen on changes within a file to process the lines one by one.
>
>
> <from uri="stream:file?fileName=sample.csv&amp;scanStream=true&amp;scanStreamDelay=1000&amp;retry=true" />
>
>
> But I noticed it always starts from the beginning. Is there an option in Camel to have "tail -f" behaviour to trigger my route?
>
>
> Thanks
>
> Oli
>



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Claus Ibsen (@davsclaus) riding the Apache Camel<http://davsclaus.com/>
davsclaus.com
A blog about Apache Camel, by Claus Ibsen, the leading contributor, and author of the Camel in Action book.



Camel in Action 2: https://www.manning.com/ibsen2

Re: file input with tail -f behaviour

Posted by Claus Ibsen <cl...@gmail.com>.
What do you mean by start from beginning?

It ought to read line by line when the file is appended. And if a new
file is created it starts from top again.
If you shutdown Camel, it does not remember where it was last time,
and start all over again

On Fri, Mar 24, 2017 at 11:28 AM, Oliver Wulff <ow...@talend.com> wrote:
> Hi there
>
>
> I've tried to use the stream input component to listen on changes within a file to process the lines one by one.
>
>
> <from uri="stream:file?fileName=sample.csv&amp;scanStream=true&amp;scanStreamDelay=1000&amp;retry=true" />
>
>
> But I noticed it always starts from the beginning. Is there an option in Camel to have "tail -f" behaviour to trigger my route?
>
>
> Thanks
>
> Oli
>



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