[
https://issues.apache.org/activemq/browse/CAMEL-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40567
]
Roman Kalukiewicz commented on CAMEL-208:
-----------------------------------------
I see that my patch doesn't solve all the problem that is a little deeper. When
you call {{setOutBody}} all it does it sets body of out message. As it is
invoked in pipeline then previous _out_ header becomes _in_ header. Then we set
_out_ body and the header previously set is lost.
I'm starting to think that this is just a _feature_ of the fact that we have
_in_ and _out_ messages and the way pipeline works. But then it is quite
confusing for end users as the first impression is that after executing the
snippet I presented in previous comment we will have body _and_ header set.
At the moment I don't really know how to solve that problem, but I just want to
show it.
Anyway patch I provided is (I believe) OK because of consistency with
{{ExchangeHelper.copyResults}}.
> setOutHeader doesn't work in pipeline
> -------------------------------------
>
> Key: CAMEL-208
> URL: https://issues.apache.org/activemq/browse/CAMEL-208
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 1.3.0
> Reporter: Roman Kalukiewicz
> Attachments: pipeline.patch
>
>
> Construct like:
> {code}
> setOutHeader("header", constant("test")).
> setOutBody(constant("body"));
> {code}
> doesn't work because {{setOutHeader()}} sets only header on out message that
> has {{null}} body. Then in pipeline when it creates new exchange it copies
> out message to in _only_ when out message is not null and it contains not
> null body (that is not the case here). So pipeline copies in -> in so our out
> header is lost.
> Set out header should just copy message body or (I believe better solution)
> {{createNewExchange}} in pipeline should use out message even if body is null
> (consistent with {{ExchangeHelper.copyResults}}).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.