On Sun, Apr 19, 2009 at 8:53 PM, Roman Kalukiewicz <[email protected]> wrote: > 2009/4/18 Claus Ibsen <[email protected]>: >> We could add boolean hasOut() as a method on the Exchange. >> Then you can test whether an OUT has been set or not. >> >> even though getOut(false) does exactly that. Returning null if no OUT exists. > > This is not my point, that there is no clear way of verifying if there > is out or not. There is one you described. > > The problem (I believe) is in the way getOut() method works. The > majority of developers assume, that getter (and getOut() conforms to > JavaBean getter) will not modify anything in a way that can seriously > influence future behavior. In the case of getOut() an invocation of > this method can change the flow VERY significantly (in pipeline when > there is no OUT). > > Only this possible misunderstanding is my concern (and believe me - I > found a lot of cases when it happened to fresh camel riders) Yeah I follow you. The lazy stuff here is not also my cup of tea .. sorry coffee.
As the components in Camel does not strickly adhere to MEP ruling you can eg set an OUT on a InOnly Exchange :) The rule of thumb is that the Camel router will use OUT (if any exists) over IN when it passes an Exchange from one node in the route graph to the next. Maybe we should consider forcing the getOut() to act as you suggest. This will breaks some internal assumpts in the framework. But that is fixable :) Any thoughts. Its not to speak up before the 2.0 API settles. Sidenote: ======== In fact I am in favor of NOT having an API that has IN/OUT/FAULT but only a single PAYLOAD. But I understand the IN/OUT/FAULT combo comes from the JBI API that Camel started out to mirror. And at the same time I would remove the Attachments API as well, as its only used actively in a few/one component = mail. I think it was a mistake it was added to the Camel API. This would trim the central API in Camel = Exchange/Message and make it easier to work with Camel. But we have debated this before :) ========== > > Roman > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus Apache Camel Reference Card: http://refcardz.dzone.com/refcardz/enterprise-integration
