camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Goyal, Arpit" <arpit.go...@sap.com>
Subject RE: First time create SFTP File and then Append to same in loop.
Date Wed, 31 Aug 2016 17:22:46 GMT
Hi Clause,

The problem is -- First time execution creates the file and in loop appends the data. Now
the process ends and file is available at SFTP folder. Second time execution, it will again
append resulting to business logic failure, as file should be created fresh - and user might
give FIXED name of the file.  

What I want is during execution, first time SFTP Endpoint should have fileExist=Override and
when the loop gets triggered, change the SFTP property fileExist to APPEND. 

I was looking something like -- during the loop, MyProcessor can either change the configuration
of SFTP Endpoint or set a header which SFTP Endpoint honors above the URI options provided.


	Approach 1:  camelContext.getEndpoint("<some-id-of-sftp-endpoint>", SftpEndpoint.class).setFileExists(GenericFileExists.APPEND)
	Approach 2: in.setHeader("fileExists", GenericFileExists.APPEND);

Regards,
Arpit.

-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: Wednesday, August 31, 2016 12:35 AM
To: users@camel.apache.org
Subject: Re: First time create SFTP File and then Append to same in loop.

Can you not just use fileExists=Append always so the data is always
appended if the file exists?


On Wed, Aug 31, 2016 at 2:46 AM, Goyal, Arpit <arpit.goyal@sap.com> wrote:
> Hi Colleagues,
>
> We have the following route:
>
> from("xxx:inbound").process(new MyProcessor()).choice(when(header("record_count").isGreaterThan(0)).to("sftp://xyx[?options]").to("xxx:inbound").otherwise(new
MyEndProcessor())
>
> It is a simple loop condition using choice where one branch process data and send to
SFTP server and then loop back where else other branch would end the process.
>
> Question: In FIRST SFTP write we want the FILE to be created. When second call comes,
then we want APPEND to happen. How can we achieve this? Was searching for some header where
I can toggle the value of 'fileExists'.
>
> Can I change end point configuration using some custom bean? Please help.
>
> Regards,
> Arpit.



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