[
https://issues.apache.org/activemq/browse/CAMEL-1563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51421#action_51421
]
Roman Kalukiewicz commented on CAMEL-1563:
------------------------------------------
Maybe I should just give an example of what happens in current state of API:
You have a flow like
{code}
from(endpointA).setHeader("foo", constant("bar")).to(endpointB);
{code}
You are naive Camel developer and you would like to see the message after
{{setHeader}} operation. What you do is:
{code}
from(endpointA)
.setHeader("foo", constant("bar"))
.process(new Processor() {
void process(Exchange exchange) {
System.out.println(exchange.getIn());
System.out.println(exchange.getOut());
}
})
.to(endpointB);
{code}
What just happened is you lost your body and header. You cannot really expect
it just by looking at the code, can you? I believe everyone agree that code
should be self-explaining without looking into the sources or javadoc.
And I've seen a lot of such mistakes and people were asking what happened to
their messages ;)
Of course it goes to my belief that we don't need in/out/fault and they only
make things harder, but I'll not start it again ;)
> Message - getOut, getFault should not create empty message if none exists
> -------------------------------------------------------------------------
>
> Key: CAMEL-1563
> URL: https://issues.apache.org/activemq/browse/CAMEL-1563
> Project: Apache Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 2.0-M1
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.0.0
>
>
> The getOut and getFault methods on org.apache.camel.Message creates a new
> empty object if none exists already.
> This confuses end users when they use the methods in their custom processors.
> We should instead add hasOut, hasFault methods that can be used for checking
> if it exists or not.
> *Note:* The getOut(false) can be used to not create a new message if none
> exists but its really not adhering to good java beans standard.
> See nabble:
> http://www.nabble.com/Payload-Gets-Nulled-Out-td23105477.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.