You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lumi velicanu <lu...@gmail.com> on 2013/07/17 20:29:01 UTC

File append issue for an SFTP producer

Hi,

I am experiencing a file append issue with a sql consumer and an sftp
producer. On the sftp producer I have fileExist=Append but instead of
appending to the file, it does an override. The problem seems to be on
the sftp side because when I test it with ftp it works correctly.

This happens for a SINGLE sql consumer poll. The sql select returns
three rows but the output file contains only the last row preceded by
a bunch of white spaces. A second poll will append to the file but
again only the last row (preceded by a bunch of spaces) to the file.

Again this all works fine with ftp - all the selected rows are
appended to the file and there are no additional spaces inserted.

Here is the route:

<route>
   <from
      uri="sql:{{sql.selectData}}?consumer.delay={{sql.consumer.delay}}&amp;consumer.onConsume={{sql.updateData}}"
/>
   <marshal>
      <csv delimiter="," />
   </marshal>
   <to
      uri="sftp:{{ftp.url}}{{ftp.import.folder}}?{{ftp.username.password}}&amp;fileExist=Append&amp;fileName={{ftp.filename}}"
/>
</route>


And the endpoints are resolved to:

sftp://xfer.companyname.net:22/Dev/terminal_import?fileExist=Append&fileName=punches.csv&password=******&username=username.com

sql://select * from my_table where
STATUS=0?consumer.delay=60000&consumer.onConsume=update my_table set
STATUS = 1 where STATUS = 0


This is a standalone java application using a spring container. I’m
using jdk 1.7.07, Camel 2.11 and sqljdbc4.


As I'm new with Apache Camel, the root cause is probably simple. Any
help would be highly appreciated.


Thanks,
Lumi