-
1. Re: Retain camel exchange.attachments
davsclaus Dec 8, 2011 11:25 AM (in response to rchallapalli)What version of Camel are you using?
-
2. Re: Retain camel exchange.attachments
rchallapalli Dec 8, 2011 4:49 PM (in response to davsclaus)Hi Claus,
I am using 2.8.3 version of Camel. Blueprint. FUSE ESB 4.4.1-fuse-01-06.
Thanks,
ravi
-
3. Re: Retain camel exchange.attachments
davsclaus Dec 9, 2011 10:33 AM (in response to rchallapalli)Ah okay so you have a custom data format, and in the marshal() method you need access to the attachments?
You should be able to access them from the OUT message on the Exchange.
As always create a small unit test, and set a break point, and debug. And see what you got on the passed in Exchange parameter.
-
4. Re: Retain camel exchange.attachments
rchallapalli Dec 9, 2011 11:49 AM (in response to davsclaus)Thanks for the response Claus!
I have a custom DataFormat - MultiPartDataFormat.
I debugged the code as you mentioned but the attachments are not present in both In and Out referneces of the exchange.
I had implemented the Processor interface on the same MultiPartDataFormat class and invoked the unmarshal() method from the process() method - just that no other code change. Changed the route to call process( (Processor) multiPartDataFormat) instead of unmarshal(multiPartDataFormat) and then the attachments are retained in the In message itself and were available in the MultiPartDataFormat.marshal(...).
The only difference in both the methods is unmarshal() has a return type and I returned what forms the body() of the In message as seen on an example (http://camel.apache.org/custom-dataformat.html).
Not sure what to return so I tried returning the whole exchange object but then it looks like it goes into an infinite loop and goes out of memory.
For now calling the processor has solved my problem but I feel DataFormat/unmarshall/marshal way would be more meaningful for the purpose.
Thank you,
raiv
-
5. Re: Retain camel exchange.attachments
davsclaus Dec 11, 2011 11:24 PM (in response to rchallapalli)Ah yeah there is a difference between marshal and unmarshal. Where the latter, is supposed to construct a new message body.
We should look into allowing you to return a Message instance, or possible just the plain Exchange as alternative. And then Camel should detect that if its a Message or Exchange then react differently. We do this for the Splitter EIP etc.
I will log a JIRA.
-
6. Re: Retain camel exchange.attachments
davsclaus Dec 11, 2011 11:26 PM (in response to davsclaus)Ticket created
-
7. Re: Retain camel exchange.attachments
rchallapalli Dec 12, 2011 4:43 AM (in response to davsclaus)Thanks Claus!!