After did some patch work, I have to take my world back. I don’t think we need 
to copy the attachment back in the InvokeProcessor.

For BeanExpression, we are not supposed to modify the exchange or the message 
in the evaluation processor, camel just want to know the result of the 
evaluation.

If you want to change the message attachment header, you can use bean process 
to do that kind of job. I just commit an unit test[1] to show how to set the 
attachment in the bean processor.

[1]http://git-wip-us.apache.org/repos/asf/camel/commit/a749cefe 
--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On July 3, 2014 at 10:18:08 PM, Willem Jiang (willem.ji...@gmail.com) wrote:
> Yeah, we need to copy the attachments back.
> I just filled a JIRA[1] for it.
>  
> [1]https://issues.apache.org/jira/browse/CAMEL-7575
>  
> --
> Willem Jiang
>  
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>  
>  
>  
> On July 3, 2014 at 8:00:24 PM, sabri.bousselmi (infosa...@yahoo.fr) wrote:
> > I think there is a serious issue when evaluatiog Bean language expression. 
> > it
> > seems like attachments are not copied from the resulting exchage.
> > very simple case: invoke a methode where you add an attachment to the
> > exchange, when the evaluation is ending the value of the exchange will be
> > null.
> > I debuged in camel source code, the method process Line n:174 did not copie
> > the attachment, below the source code:
> > -------------------------------
> > // copy the original exchange to avoid side effects on it
> > Exchange resultExchange = exchange.copy();
> > // remove any existing exception in case we do OGNL on the
> > exception
> > resultExchange.setException(null);
> >
> > // force to use InOut to retrieve the result on the OUT
> > message
> > resultExchange.setPattern(ExchangePattern.InOut);
> > processor.process(resultExchange);
> > result = resultExchange.getOut().getBody();
> >
> > // propagate properties and headers from result
> > if (resultExchange.hasProperties()) {
> >
> > exchange.getProperties().putAll(resultExchange.getProperties());
> > }
> > if (resultExchange.getOut().hasHeaders()) {
> >
> > exchange.getIn().getHeaders().putAll(resultExchange.getOut().getHeaders()); 
> >  
> > }
> >
> > // propagate exceptions
> > if (resultExchange.getException() != null) {
> > exchange.setException(resultExchange.getException());
> > }
> > -------------------------------------------------------------------------  
> > can you please approve the issue.
> >
> >
> >
> > --
> > View this message in context: 
> > http://camel.465427.n5.nabble.com/Attachments-are-Lost-using-Bean-Language-tp5753283.html
> >   
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>  
>  

Reply via email to