You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Hubert Landl (JIRA)" <ji...@apache.org> on 2018/03/09 09:00:00 UTC

[jira] [Commented] (CAMEL-10424) Bean should act like transform/setBody when setting result

    [ https://issues.apache.org/jira/browse/CAMEL-10424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16392616#comment-16392616 ] 

Hubert Landl commented on CAMEL-10424:
--------------------------------------

Is this adaption a break against the message exchange pattern?

We use in some routes ExchangePattern.InOnly.
To remove unwanted headers, we set our required headers and body to Exchange.OUT.
In the next bean we always get the "cleaned" exchange object where in the IN part of the exchange only our expected headers are available.

Due to this adaption headers from IN and OUT are merged in Method "MethodInfo.fillResult" because exchange objects will be handled as OUT capable when exchange.hasOut()=true.
{code:java}
...
// the bean component forces OUT if the MEP is OUT capable
boolean out = ExchangeHelper.isOutCapable(exchange) || exchange.hasOut();
...
{code}
 

I expected that no "old" headers are available in the next bean and that setting from OUT to IN is only done in Method "PipelineHelper.createNextExchange(...)":
{code:java}
public static Exchange createNextExchange(Exchange previousExchange) {
 Exchange answer = previousExchange;
// now lets set the input of the next exchange to the output of the
 // previous message if it is not null
 if (answer.hasOut()) {
    answer.setIn(answer.getOut());
    answer.setOut(null);
 }
 return answer;
 }
{code}
I use currently Camel 2.17.7 and would upgrade to 2.20.2.

> Bean should act like transform/setBody when setting result
> ----------------------------------------------------------
>
>                 Key: CAMEL-10424
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10424
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.18.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 2.18.1, 2.19.0
>
>
> See SO
> http://stackoverflow.com/questions/40293128/camel-rest-service-throws-exception-when-returning-null/40317432#40317432
> When you use http components that set the message as HttpMessage and then call bean that returns null then we should do like transform/setBody does to set the message as a default message.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)