Thank you for reply.

Workaround for this problem, 
--------------------------------------------
route: fileConsumer -> some components ->
processor(SetOriginalMessageProcess)
--------------------------------------------
public class SetOriginalMessageProcess implements Processor{
       public void process(Exchange exchange) throws Exception {
               Message original =
exchange.getUnitOfWork().getOriginalInMessage();
               exchange.setOut(original);
       }
}
--------------------------------------------
This workaround works good!
I use "setOut()" since  I found a bit of another problem.


Last processor of route does not copy inMessage to outMessage.
For example,
route1: cxf -> processor(using getIn())               response: null
route2: cxf -> processor(using getIn()) -> log      response: object from
"getIn().setBody(object)".
route3: cxf -> processor(using getIn()) -> mock   response: object from
"getIn().setBody(object)".

So I use "setOut()" in last processor of route.



willem.jiang wrote:
> 
> Hi,
> 
> I just check the code of CxfProducer, I don't think it copy the 
> InMessage header to the OutMessage.
> I will write a test case to verify it.
> 
> Willem
> 
> ariablu wrote:
>> OK!
>> 
>> The same can be said for CxfProducer?
>> 
>> When
>> route: File -> Processor2(getIn()) -> cxf(not comment) -> Log
>> 
>> Result ... NG
>> 
>> 
>> 
>> 
>> Claus Ibsen-2 wrote:
>>> On Fri, Jan 22, 2010 at 4:24 PM, ariablu <962...@gmail.com> wrote:
>>>> Next test,
>>>> test processor1 -> NG
>>>> test processor2 -> GOOD!
>>>>
>>>> "getOut()" breaks FileExchange data?
>>>> "newName"  in GenericFileExpressionRenamer class is defferenet value
>>>> each
>>>> test.
>>>>
>>> Ah that is your problem because you use getOut() which creates a
>>> totally new Message which forgets all about the previous one.
>>>
>>> You have to either replace data on IN (which is the easiest to do)
>>> Or copy from IN to OUT
>>>
>>> The getOut() has caused pain before and people should IMHO just stick
>>> to getIn() and manipulate that one.
>>>
>>>
>>> In the future we will rework the API a bit so Camel will detect this
>>> so when you do a getOut() it can safely copy the headers and whatnot.
>>>
>>>
>>>
>>>> [GenericFileExpressionRenamer]
>>>>  String newName = expression.evaluate(exchange, String.class);
>>>>
>>>>
>>>> --------------------------------------------
>>>> [[processor1]]
>>>> 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"});
>>>> }       }
>>>> --------------------------------------------
>>>> [[processor2]]
>>>> 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.getIn().setHeader("operationNameSpace",
>>>> "http://pc.ws";);
>>>>               exchange.getIn().setHeader("operationName", "echo");
>>>>               exchange.getIn().setBody(new Object[]{"AAAAA", "BBBBB"});
>>>> }       }
>>>> ---------------------------------------------
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>> Hi
>>>>>
>>>>> Can you try using TRACE logging for this log name:
>>>>> org.apache.camel.component.file
>>>>>
>>>>> eg if using log4j then its:
>>>>> log4j.logger.org.apache.camel.component.file=TRACE
>>>>>
>>>>> The should be detailed info how the filename is being evaluated.
>>>>> Wonder if Windows got something mixed up with the path separators.
>>>>>
>>>>>
>>>>> On Fri, Jan 22, 2010 at 11:31 AM, ariablu <962...@gmail.com> wrote:
>>>>>> 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 <962...@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.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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.-tp27260194p27274871.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.-tp27260194p27307990.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to