You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by patelp <Pr...@ge.com> on 2014/11/19 15:19:52 UTC

PollEnrich timeout not working

I have a directory that contains two files, file1.txt and file2.txt, and my
camel route picks file1.txt processes it line by line and uses file2 as a
resource for additional information. I am using pollEnrich to read the
second file. My camel.xml file looks as follows.
<route id="id1" errorHandlerRef="loggingErrorHandler">
            <from uri="file://file1.txt" />
            <pollEnrich uri="file://file2.txt"
strategyRef="aggregationStrategy"  timeout="1000"/>
            <to uri="{{someProcess}}" />	 	
            <doTry>
            	 <split>
                    <simple>${body}</simple>
                    
                    	<bean ref="processData" />
                        <aggregate strategyRef="listAggregationStrategy">
                            <correlationExpression>
                                <constant>true</constant>
                            </correlationExpression>
                            <completionPredicate>
                                <method bean="listAggregationStrategy"
method="isComplete" />
                            </completionPredicate>
                            <to uri="{{outboundUri}}" />
                        </aggregate>                    
                </split>
               
                <doFinally>
                    <to uri="{{processEnd}}" />
                </doFinally>
            </doTry>
        </route>

What I am trying to achieve here is pick file2.txt using pollEnrich if it
exists. If the file isn't there I want to wait for 10 seconds and after 10
seconds if the file still isn't there I want to exit out. 
However, my program currently doesnt exist out even when I insert timeout.
It waits forever for the file. 

What am I doing wrong here?

Thanks for the help!



--
View this message in context: http://camel.465427.n5.nabble.com/PollEnrich-timeout-not-working-tp5759329.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: PollEnrich timeout not working

Posted by patelp <Pr...@ge.com>.
That's exactly how I have it in my code. It's picking the file from the
directory when it exists so the file path is correct. But the issue is its
waiting forever for the file, when the file doesn't exist, instead of
waiting until timeout and exiting out.



--
View this message in context: http://camel.465427.n5.nabble.com/PollEnrich-timeout-not-working-tp5759329p5759331.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: PollEnrich timeout not working

Posted by Claus Ibsen <cl...@gmail.com>.
It should be

<pollEnrich uri="file:someDirName?fileName=file2.txt" timeout="10000" ...>

And mind the timeout is in milli seconds. For the file url you need a
starting directory and then specify the file name as an parameter

On Wed, Nov 19, 2014 at 3:19 PM, patelp <Pr...@ge.com> wrote:
> I have a directory that contains two files, file1.txt and file2.txt, and my
> camel route picks file1.txt processes it line by line and uses file2 as a
> resource for additional information. I am using pollEnrich to read the
> second file. My camel.xml file looks as follows.
> <route id="id1" errorHandlerRef="loggingErrorHandler">
>             <from uri="file://file1.txt" />
>             <pollEnrich uri="file://file2.txt"
> strategyRef="aggregationStrategy"  timeout="1000"/>
>             <to uri="{{someProcess}}" />
>             <doTry>
>                  <split>
>                     <simple>${body}</simple>
>
>                         <bean ref="processData" />
>                         <aggregate strategyRef="listAggregationStrategy">
>                             <correlationExpression>
>                                 <constant>true</constant>
>                             </correlationExpression>
>                             <completionPredicate>
>                                 <method bean="listAggregationStrategy"
> method="isComplete" />
>                             </completionPredicate>
>                             <to uri="{{outboundUri}}" />
>                         </aggregate>
>                 </split>
>
>                 <doFinally>
>                     <to uri="{{processEnd}}" />
>                 </doFinally>
>             </doTry>
>         </route>
>
> What I am trying to achieve here is pick file2.txt using pollEnrich if it
> exists. If the file isn't there I want to wait for 10 seconds and after 10
> seconds if the file still isn't there I want to exit out.
> However, my program currently doesnt exist out even when I insert timeout.
> It waits forever for the file.
>
> What am I doing wrong here?
>
> Thanks for the help!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/PollEnrich-timeout-not-working-tp5759329.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/