Return-Path: Delivered-To: apmail-camel-dev-archive@www.apache.org Received: (qmail 99175 invoked from network); 14 Jul 2009 10:04:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jul 2009 10:04:24 -0000 Received: (qmail 61117 invoked by uid 500); 14 Jul 2009 10:04:34 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 61087 invoked by uid 500); 14 Jul 2009 10:04:34 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 61077 invoked by uid 99); 14 Jul 2009 10:04:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jul 2009 10:04:34 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.198.246 as permitted sender) Received: from [209.85.198.246] (HELO rv-out-0708.google.com) (209.85.198.246) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jul 2009 10:04:23 +0000 Received: by rv-out-0708.google.com with SMTP id c5so945123rvf.56 for ; Tue, 14 Jul 2009 03:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Ot2Q84AsM/pXRh8hM5euNXGp/w+7fqYcYClvQCac6qA=; b=QQObA3ecfDRK7kkv+YzWn9p2YF29FvLmm4y3oEiZ9rX/p986fqpc/5Df9h17V2t28p SEP0h6ealNfk3Veu+Hu/3AeLsOhD68OjvAM2feXlGnDEAbZjzsXJvR4GhgBluwNY/R2h f+jXOTG1bL/QKEXMac3NNf1BbyeKZBEa6ocTg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=H7FZ5uUvgpv8i6rT8U56PHYrIhz9L5/0X8p6EKKmG5o92t2Epw0TRr9DHceEgJ2LT6 zdzM7ZrMPitXBagwAokkCi5tzaKh1hqa96RKazjUmEr88rv7Zj80ycivav0k6Oc+Pmoa Mrh9mouALHFRDtcohvqnkAY7/7Kh2/iEayIbo= Received: by 10.140.143.9 with SMTP id q9mr3566093rvd.198.1247565840480; Tue, 14 Jul 2009 03:04:00 -0700 (PDT) Received: from ?192.168.0.158? ([123.113.116.252]) by mx.google.com with ESMTPS id k2sm28045878rvb.12.2009.07.14.03.03.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 14 Jul 2009 03:04:00 -0700 (PDT) Message-ID: <4A5C580C.6090700@gmail.com> Date: Tue, 14 Jul 2009 18:03:56 +0800 From: Willem Jiang User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: dev@camel.apache.org Subject: Re: [DISCUSS] Semantics of IN and OUT References: <08620754-CF9D-4FFE-8008-953FEF3E0370@gmail.com> <5380c69c0907120223i33d3b687l3df885c96cba5aab@mail.gmail.com> <5380c69c0907130920t1c243aafwd3ce59ba844c570d@mail.gmail.com> <5380c69c0907131051i1ed6d881qf410ad5bf0727f16@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org James Strachan wrote: > 2009/7/13 Claus Ibsen : >>> Reading between the lines; are you really just trying to make folks >>> use (what is currently called) "getOut()" and never try mutate what is >>> currently called getIn()? >>> >>> i.e. so by default the "OUT" property is defaulted to a copy of IN >>> that folks can change/mutate. >>> >>> (what we call these 2 methods is a separate discussion, whether its >>> "in,out" or "originalMessage,message" or whatever >>> >> Hadrian and I had a chat today and we are clearing up some bits. >> I am more on line with him now on the IN and OUT thing. >> >> So lets keep them. >> >> And use the time to fix the tiny bits such as the getOut() doing its >> lazy creating a new empty message. >> And whether its possible to let IN be immutable. > > I think we're kinda mostly on the same page (though saying it in > different ways). BTW I'm taking off my devils advocate hat now :)... > > What we're agreeing on I think is that; > > * getIn() should be immutable (when folks try to change it we can > throw the exception and describe how getOut() should be used to change > the message) - to prevent folks using the old code (which will require > code changes). > * having the original immutable message available is handy; but mostly > folks should concentrate on the 'out' (current name today) > * the out should be automatically populated with a clone of the IN (to > avoid all that pain with checking if there's an out or an in, or the > possible loss of headers etc. Internally we can use a CopyOnWrite > facade to reduce the cost of potentially copying a message which is > not actually mutated. > > Given that; I think we're mostly agreeing. However given the confusion > of getIn() and getOut() I'm wondering if actually your previous idea > of changing the api of exchange to have a getMessage() which returns > the thing a processor should be changing; then having a > getOriginalMessage() (which can be null if you are the first in the > chain) might reduce the amount of confusion? > > i.e. after sleeping on it, I'm warming to the idea of renaming getIn() > -> getOriginalMessage() and getOut() -> getMessage(). (Or maybe > getInputMessage() for getIn()?) > > Thoughts? > +1 for this change. For the InOnly Message Exchange Pattern, when we want to change the message , we just call the exchange's getMessage() and don't not care about if it's a in message or an out message. For the ProduceTemplate sendMessage() method we can get the response message back from the exchange, by using exchange.getMessage() method. Willem