You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kanmisc <ka...@gmail.com> on 2011/11/18 13:12:24 UTC

How to reset the body content before routing to next endpoint

Hi 

I have similar routes as below  -

<route id="ftpIn">
	<from uri="sftp://InputLlocation" />
	<bean ref="registrationProcess" />
	<to uri="direct:moveSuccessFiles"/>
	<stop/>
</route>

<route id="ftpMove1">
	<from uri="direct:moveSuccessFiles"/>
	<from uri="file://location1?filter=#successFileFilter"/>
	<to uri="sftp://successLocation" />
	<to uri="direct:moveFailedFiles"/>
</route>

<route id="ftpMove2">
	<from uri="direct:moveFailedFiles"/>
	<from uri="file://location2?filter=#failureFileFilter"/>
	<to uri="sftp://failedLocation" />
</route>

After reading from the first route(/ftpIn/), /registrationProcess/ bean
creates 2 different files. Then they need to be uploaded to 2 different ftp
locations.

In this case when uploading in route /ftpMove1/, it also uploads the content
of body from the first route(/ftpIn/). And in route /ftpMove2/, it uploads
along with body of /ftpIn/ and /ftpMove1/.

I tried setting as below which is not solving - 
<setBody ><constant>null</constant></setBody>

Is it possible to remove/reset the body before moving to the next route?

Thanks
Kannan

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-reset-the-body-content-before-routing-to-next-endpoint-tp5004107p5004107.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to reset the body content before routing to next endpoint

Posted by kanmisc <ka...@gmail.com>.
Thanks for the reply. Yes, i tried that first. But the use case here is
different. No need to move the same file(consumed in /ftpIn/ route) to
error/success locations.  move and moveFailed options worked in this case.

But the bean(registrationProcess) creates 2 different files in different
locations, which again need to be FTPed to different locations.

Thanks

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-reset-the-body-content-before-routing-to-next-endpoint-tp5004107p5016388.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to reset the body content before routing to next endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The file/ftp components offer options to move files to a error /
success folder out of the box.
So you do not need to do this with extra routes.

The ftp component
http://camel.apache.org/ftp2

Has 99% of the options from the file component
http://camel.apache.org/file2

See the options
- move
- moveFailed




On Fri, Nov 18, 2011 at 1:12 PM, kanmisc <ka...@gmail.com> wrote:
> Hi
>
> I have similar routes as below  -
>
> <route id="ftpIn">
>        <from uri="sftp://InputLlocation" />
>        <bean ref="registrationProcess" />
>        <to uri="direct:moveSuccessFiles"/>
>        <stop/>
> </route>
>
> <route id="ftpMove1">
>        <from uri="direct:moveSuccessFiles"/>
>        <from uri="file://location1?filter=#successFileFilter"/>
>        <to uri="sftp://successLocation" />
>        <to uri="direct:moveFailedFiles"/>
> </route>
>
> <route id="ftpMove2">
>        <from uri="direct:moveFailedFiles"/>
>        <from uri="file://location2?filter=#failureFileFilter"/>
>        <to uri="sftp://failedLocation" />
> </route>
>
> After reading from the first route(/ftpIn/), /registrationProcess/ bean
> creates 2 different files. Then they need to be uploaded to 2 different ftp
> locations.
>
> In this case when uploading in route /ftpMove1/, it also uploads the content
> of body from the first route(/ftpIn/). And in route /ftpMove2/, it uploads
> along with body of /ftpIn/ and /ftpMove1/.
>
> I tried setting as below which is not solving -
> <setBody ><constant>null</constant></setBody>
>
> Is it possible to remove/reset the body before moving to the next route?
>
> Thanks
> Kannan
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-reset-the-body-content-before-routing-to-next-endpoint-tp5004107p5004107.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/