1 Reply Latest reply on Aug 4, 2009 11:29 AM by Claus Ibsen

    FTP check file exists

    vector_jdev.work Newbie

      I need to get file from FTP and handle it with bean.

      If there is no file on FTP to handle - then I need to send an email.

      I have a route:

       

      <from uri="ftp://my_login@myftp.com/myfile.txt?consumer.delay=5000//my_login@myftp.com/myfile.txt?consumer.delay=5000"/>

      <to uri="file://c:/!!?expression=downloaded/$/$"/>

        <choice>

          <when>

            <javaScript>request.headers.get('org.apache.camel.file.name.produced') != null</javaScript>

                <setBody>

                   <constant>HANDLE FILE!!!</constant>

                </setBody>

                <to uri="log:cat_nc?showAll=true&amp;multiline=true"/>

           </when>

           <otherwise>

              <setBody>

                   <constant>SEND MAIL!!</constant>

              </setBody>

              <to uri="log:cat_nc?showAll=true&amp;multiline=true"/>

           </otherwise>

      </choice>

       

      When I have myfile.txt on FTP it's working OK. When there is no any file the whole route is stopped on File with name $ doesn't exists</constant>

      </setBody>

       

      The above expression doesn't work

       

      Thanks

       

      Edited by: vector on Aug 4, 2009 2:35 PM