You cannot have from in the nested route in the rest-dsl.
If you want to upload a file to a FTP server and write the file using
a temp name, then use the tempFileName or tempPrefix options. The
tempPrefix is the easiest to get started with
http://camel.apache.org/file2
And if you want to trigger the upload using rest GET call then do a
rest GET
poll enrich file
to ftp
On Tue, Apr 5, 2016 at 9:11 AM, janvandeklok wrote:
> Hello, I need to create a file with lots of data depending on a user request
> and transfer that temp file to a remote ftp. I have everything running
> without errors and the remote file is created but the content of the created
> remote file is still 0 bytes while the temp file has lots of bytes.
> I don't understand what i'm doing wrong.
>
> Here's the essence of my code:
>
>
>
> public class MYRoute extends AbstractRoute {
>
> public void configure() throws Exception
> {
> super.configure();
>
>
> File temp = File.createTempFile("mytempfile.json");
>
> String uriOut = "sftp://"+ System.getenv("my_sftp_host")+
> "/INCOMMING?"
> + "eagerDeleteTargetFile=false&"
> + "exchangePattern=OutOnly&"
> + "allowNullBody=true&"
> + "fileName=my_gen_inf.json&"
> + "password="+ System.getenv("my_sftp_password")+ "&"
> + "username="+ System.getenv("my_sftp_username")+ "&"
> + "timeout=6&"
> + "useList=false";
>
>
> rest("some url")
> .get("/generic").produces(MIME_MEDIA_TYPE_JSON)
> .route()
> .routeId("MY_generic_interface")
> .process(new fillTempFileWithaLotOfData(temp.toURI()))
> .from(temp.toURI().toString())
> .to(uriOut)
> .setBody(constant("{ 'result': 'OK'}"));
> }
>
>
> Any help is appreciated.
>
> Jan van de Klok
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-write-content-of-temp-file-to-remote-ftp-tp5780480.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2