[
https://issues.apache.org/jira/browse/CAMEL-3388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966873#action_12966873
]
Aaron Mulder edited comment on CAMEL-3388 at 12/4/10 7:12 PM:
--------------------------------------------------------------
The problem seems to lie in Pipeline.createNextExchange
It looks like if you use @OutHeaders then you force an out message to be
created, which means in this pipeline method it will overwrite the in message
(containing your bean return value) with the out message (containing only
headers).
I'm not sure what the appropriate resolution is. If it's an InOnly exchange
then it probably doesn't make sense to overwrite the in message with the out
message.
It seems like if you write to the out headers in a bean method you are trying
to control what headers are present in the message after the bean method
invocation completes. Perhaps if it's an InOnly exchange then no out message
should be generated by using @OutHeaders, it should just supply a new empty
map, and after the invocation has completed, replace the in headers with the
new map?
You might say that you shouldn't use @OutHeaders for an InOnly exchange, but in
some cases (JMS, or a reusable bean component) you might not know whether it's
an InOnly or InOut exchange just based on the route definition, and it doesn't
seem like you should need different bean methods and a content based router
that looks at the exchange pattern just because you always want to put some
headers into the output message.
was (Author: ammulder):
The problem seems to lie in Pipeline.createNextExchange
It looks like if you use @OutHeaders then you force an out message to be
created, which means in this pipeline method it will overwrite the in message
(containing your bean return value) with the out message (containing only
headers).
I'm not sure what the appropriate resolution is. If it's an InOnly exchange
then it probably doesn't make sense to overwrite the in message with the out
message.
It seems like if you write to the out headers in a bean method you are trying
to control what headers are present in the message after the bean method
invocation completes. Perhaps if it's an InOnly exchange then no out message
should be generated by using @OutHeaders, it should just supply a new empty
map, and after the invocation has completed, replace the in headers with the
new map?
You might say that you shouldn't use @OutHeaders for an InOnly exchange, but in
some cases (JMS) you might not know whether it's an InOnly or InOut exchange
just based on the route definition, and it doesn't seem like you should need
different bean methods and a content based router that looks at the exchange
pattern just because you always want to put some headers into the output
message.
> Strange bean annotation failure in Camel 2.5.0 & HEAD
> -----------------------------------------------------
>
> Key: CAMEL-3388
> URL: https://issues.apache.org/jira/browse/CAMEL-3388
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.5.0
> Reporter: Aaron Mulder
> Priority: Critical
>
> When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD,
> the in and out message both are null (the "Hello!" value just disappears):
> {code:java}
> public String doTest(@Body Object body, @Headers Map headers, @OutHeaders
> Map outHeaders) {
> return "Hello!";
> }
> {code}
> The same thing without the headers works OK:
> {code:java}
> public String doTest(@Body Object body) {
> return "Hello!";
> }
> {code}
> See
> camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.