Hi

The file component
http://camel.apache.org/file2.html

Have options where you specify where the file should be moved afterwards.
move
moveFailed

By default it will move files into a hidden .camel sub directory.


On Wed, May 19, 2010 at 3:55 AM, Vikas Kumar Arora
<[email protected]> wrote:
>
> Hi,
> My use case, Bulk Load Operation where I've several thousand XML files:
> 1. Read XML files from a folder
> 2. wrap A SOAP Message structure around that XML file
> 3. send it to Web Service
> 4. transform response from Web Service into XML response
> (which it already is, but if I give the output of WS directly to XPath I get
> java.lang.ClassCastException: java.io.ByteArrayInputStream cannot be cast to
> org.w3c.dom.Node
> ). Any way this works.
> 5. Now the problem point: now based on the SOAP message's SUCCESS or FAILURE
> status, I've to move the ORIGINAL file and it's content (original of course)
> to appropriate folder.
>
>  I was going thru the docs, and some where found that there is
> "useOriginalMessage", but that's only available at the "onException" element
> level.
>
>  But In my case I dont have any exception,
>
> 1. So I'm not sure if similar "useOriginalMessage" flag/attribute should
> also be useful at the URI level say for
> "uri=file:...?useOriginalMessage=true"?
>
> 2. Or is there any way to hold the, original file's content in Camel Global
> context (if accessible thru Camel DSL) somewhere and be available for use
> later at any point.
>
> Just like Http Session, where for a given session (or like Http Request),
> where we can keep our data for the duration of the
> Transaction(request/session) and use accordingly?
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans";
>           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>           xmlns:spring="http://www.springframework.org/schema/beans";
>           xmlns:camel="http://camel.apache.org/schema/spring";
>           xmlns:jetty="http://mortbay.com/schemas/jetty/1.0";
>
>           xsi:schemaLocation="
>                        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>                        http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-2.0.xsd
>                        http://mortbay.com/schemas/jetty/1.0 
> http://jetty.mortbay.org/jetty.xsd
>                        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
>                        ">
>        <camel:camelContext xmlns="http://camel.apache.org/schema/spring";
>                                                
> xmlns:spmlv2="urn:oasis:names:tc:SPML:2:0">
>
>                <camel:package>com.xxxxx.sample.camel.router</camel:package>
>
>                <camel:route>
>                        <camel:from 
> uri="file://C:/Projec~1/Documents/xmls/xmls?noop=true"/>
>                        <camel:to 
> uri="xslt:wrapXMLWithSOAPMessageStructure.xsl"/>
>                        <camel:to uri="bean:someBean"/>
>                        <camel:to 
> uri="http://login.abcd.com/IS/services/ISService"/>
>                        <camel:to uri="xslt:SOAPResponseMessageTransform.xsl"/>
>                        <choice>
>                            <when>
>                                
> <xpath>//spmlv2:modifyrespon...@status='success']</xpath>
>                                <camel:to
> uri="file://C:/Projec~1/Documents/xmls/xmls/success?useOriginalMessage=true"/>
>                            </when>
>                            <when>
>                                
> <xpath>//spmlv2:modifyrespon...@status='failure']</xpath>
>                                <camel:to
> uri="file://C:/Projec~1/Documents/xmls/xmls/error?useOriginalMessage=true"/>
>                            </when>
>                            <otherwise>
>
>                            </otherwise>
>                        </choice>
>                </camel:route>
>
>        </camel:camelContext>
>        <bean id="someBean" class="com.abcd.sample.camel.SomeBean" />
>
> </beans>
>
>
>
> --
> View this message in context: 
> http://old.nabble.com/Camel-File%3A-how-to-retain-Original-File-contents-when-moving-file--tp28603397p28603397.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to