camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ariablu <962...@gmail.com>
Subject Re: FileConsumer move a file to wrong destination.
Date Fri, 22 Jan 2010 10:31:56 GMT

Thank you for reply.

Next try,
using Apache Camel camel-2.2-SNAPSHOT and Spring,
route: File -> Processor -> (cxf) -> Log

When ...
/_work/test/from/1.txt

If I run test case, 1.txt file was moved to
/_work/test/backup/20100122 (not directory!)

But I want
/_work/test/backup/20100122/1.txt

--------------------------------------------------------
[[test case]]
 <camelContext xmlns="http://camel.apache.org/schema/spring">
  <endpoint id="file1"
uri="file:c:\_work\test\from?delete=false&amp;noop=false&amp;move=../backup/${date:now:yyyyMMdd}/${file:name}"/>
  <route>
    <from ref="file1"/>
    <process ref="process1"/>
    <!--  to uri="cxf"  -->
    <to
uri="log:testlog?level=INFO&showExchangeId=true&showProperties=true&showBodyType=true&showBody=true&showOut=true&multiline=true&showHeaders=true"/>
  </route>
 </camelContext>
 <bean class="test.impl.Trans" id="process1"/>
--------------------------------------------------------
[[test processor]](not changed)
--------------------------------------------------------
[[Log]]
DEBUG ProcessorEndpoint$1 - Starting producer:
Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true]
DEBUG ProducerCache - Adding to producer cache with key:
Endpoint[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true]
for producer:
Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true]
DEBUG DefaultTypeConverter - Adding fallback type converter as a known type
converter to convert from: java.lang.String to: java.lang.Object[]
INFO testlog - Exchange[
, Id:308f8107-f7c1-4ec7-b2a9-9dff16b0cbd0
,
Properties:{CamelToEndpoint=log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true,
CamelBatchSize=1, CamelBatchComplete=true,
CamelFileExchangeFile=GenericFile[c:\_work\test\from\1.txt],
CamelBatchIndex=0, CamelFileLockName=c:\_work\test\from\1.txt.camelLock,
CamelFileLock=c:\_work\test\from\1.txt.camelLock}
, Headers:{operationNameSpace=http://pc.ws, operationName=echo}
, BodyType:Object[]
, Body:[Ljava.lang.Object;@674baa
, Out: null]
DEBUG GenericFileOnCompletion - Done processing file:
GenericFile[c:\_work\test\from\1.txt] using exchange:
Exchange[GenericFileMessage with body: [Ljava.lang.Object;@674baa]
DEBUG FileUtil - Tried 1 to delete file: c:\_work\test\from\1.txt.camelLock
with result: true
DEBUG GenericFileRenameProcessStrategy - Renaming file:
GenericFile[c:\_work\test\from\1.txt] to: GenericFile[..\backup\20100122]
DEBUG FileUtil - Tried 1 to rename file: c:\_work\test\from\1.txt to:
c:\_work\test\from\..\backup\20100122 with result: true

--------------------------------------------------------

Thanks!


Claus Ibsen-2 wrote:
> 
> Hi
> 
> Could you try with 2.2-SNAPSHOT ?
> 
> It is a bit odd since Camel should pickup .done as a relative directly
> and not as a absolute filename.
> 
> You can also try to use
> move=.done/${file:name}
> 
> Which should be what Camel translates .done to under the covers.
> 
> 
> 
> On Thu, Jan 21, 2010 at 5:08 PM, ariablu <96259d@gmail.com> wrote:
>>
>> using Apache Camel 2.1 and Spring,
>> route: File -> Processor -> (cxf) -> Log
>>
>> When ...
>> /_work/test/from/1.txt
>>
>> if I run test case, 1.txt file was moved to
>> /_work/test/from/.done (not directory!)
>>
>> But I want
>> /_work/test/from/.done/1.txt
>>
>> --------------------------------------------------------
>> [[test case]]
>>  <camelContext xmlns="http://camel.apache.org/schema/spring">
>>   <endpoint id="file1"
>> uri="file:C:\_work\test\from?delete=false&amp;noop=false&amp;move=.done"/>
>>   <route>
>>     <from ref="file1"/>
>>     <process ref="process1"/>
>>     <!--  to uri="cxf"  -->
>>     <to
>> uri="log:testlog?level=INFO&amp;showExchangeId=true&amp;showProperties=true&amp;showBodyType=true&amp;showBody=true&amp;showOut=true&amp;multiline=true&amp;showHeaders=true"/>
>>   </route>
>>  </camelContext>
>>  <bean class="test.impl.Trans" id="process1"/>
>> --------------------------------------------------------
>> [[test processor]]
>> package test.impl;
>> import org.apache.camel.Exchange;
>> import org.apache.camel.Processor;
>> public class Trans implements Processor {
>>       public void process(Exchange exchange) throws Exception {
>>               exchange.getOut().setHeader("operationNameSpace",
>> "http://pc.ws");
>>               exchange.getOut().setHeader("operationName", "echo");
>>               exchange.getOut().setBody(new Object[]{"AAAAA", "BBBBB"});
>> }       }
>> --------------------------------------------------------
>> [[Log]]
>> INFO testlog - Exchange[
>> , Id:ffa13059-6465-4bb0-b9ca-8de545c50618
>> ,
>> Properties:{CamelToEndpoint=log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true,
>> CamelBatchSize=1, CamelBatchComplete=true,
>> CamelFileExchangeFile=GenericFile[C:\_work\test\from\1.txt],
>> CamelBatchIndex=0}
>> , Headers:{operationName=echo, operationNameSpace=http://pc.ws}
>> , BodyType:Object[]
>> , Body:[Ljava.lang.Object;@16be13b
>> , Out: null]
>> DEBUG GenericFileOnCompletion - Done processing file:
>> GeneriacFile[C:\_work\test\from\1.txt] using exchange:
>> Exchange[GenericFileMessage with body: [Ljava.lang.Object;@16be13b]
>> DEBUG GenericFileRenameProcessStrategy - Renaming file:
>> GenericFile[C:\_work\test\from\1.txt] to: GenericFile[\\.done]
>> DEBUG FileUtil - Tried 1 to rename file: C:\_work\test\from\1.txt to:
>> C:\_work\test\from\.done with result: true
>> --------------------------------------------------------
>>
>> Thanks!
>> --
>> View this message in context:
>> http://old.nabble.com/FileConsumer-move-a-file-to-wrong-destination.-tp27260194p27260194.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
> 
> 

-- 
View this message in context: http://old.nabble.com/FileConsumer-move-a-file-to-wrong-destination.-tp27260194p27271232.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message