Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8FEC019252 for ; Thu, 14 Apr 2016 11:28:20 +0000 (UTC) Received: (qmail 68639 invoked by uid 500); 14 Apr 2016 11:28:15 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 68592 invoked by uid 500); 14 Apr 2016 11:28:15 -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 68580 invoked by uid 99); 14 Apr 2016 11:28:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Apr 2016 11:28:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 91D45C0D80 for ; Thu, 14 Apr 2016 11:28:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.821 X-Spam-Level: X-Spam-Status: No, score=-0.821 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Di4fSM2XERiB for ; Thu, 14 Apr 2016 11:28:12 +0000 (UTC) Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com [209.85.213.179]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 3F1685F46D for ; Thu, 14 Apr 2016 11:28:11 +0000 (UTC) Received: by mail-ig0-f179.google.com with SMTP id ui10so87540104igc.1 for ; Thu, 14 Apr 2016 04:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=4ftTc6k5yt/m0nf2MxGZyhjZPUqSvFfmPeISUpTUKAM=; b=rdCCRD0u7zXUb2yfYwMyFucmu942UrqF2i4D2QBbkCerDyUpDDOBmObSfVRzguotLg kx/0jDfgg3iVAxjR8yMvQgdfeUkn9Z1NiKomupkhHqj43Eu+XFbJKKN16odGg583AToF Gew0e2fhONDwARklqgT9nBci7GMRjRR6dI5okB1dEtlidXsPcTUVHhL3Ksw76CSNpuWJ n0uzVCti5fuq77iIkBDoHWUvwB+69Sh2QOHWBfRq0F6PF9w+3SU3KP+jBFNTB41MyqAt dALvzS5pRyEWOy9T5EYZY4KbG8SnsSKvtFL2+l9KqD+1df6sDJx4sLxMhwJ9lr3m1OEh a/Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=4ftTc6k5yt/m0nf2MxGZyhjZPUqSvFfmPeISUpTUKAM=; b=MdhrDIviHCzhobYSV2zIjOffjwcoWAzXB4SBL6QoWq/IdWNAn2FT8piJ7zVOhcDrYn fUC46XJjQmxNwfOqhDPqBs6q5lBlF9K01XhxR92Iqy4XL1acwsyWVTK6Jn0mnyrQGpCd KTa7C74Ra2nOFr5Ios3iDQiyUkG/z0i6Nya3CH84MelP1G3PShqMnRbDBePZmsNuq6LS MkHl30R5jPGyP11FuM+JAr5/NzXfhcVwccluePFkkQTqlh6k9Xvmon+ukP9gbf7aqvC2 NPr1a+DoS+IzRu+H8TTOtdgLzha4H/3xxGUdGPA+UdGTy1NSOstcimysXgMgKquE6svY ffnA== X-Gm-Message-State: AOPr4FXZl8G03JkZh1U2VbdY70Ad7AJXimxrCPMLaBUlsVX+vKyoY8v6AHo2fjhjzPHnmlnX2qTuL/vgfVxF2g== X-Received: by 10.50.29.148 with SMTP id k20mr3466505igh.62.1460633287100; Thu, 14 Apr 2016 04:28:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.16.2 with HTTP; Thu, 14 Apr 2016 04:27:47 -0700 (PDT) In-Reply-To: References: <122ed6738d4c442b84a6a883bdd094e6@derote13de02.global.corp.sap> <4f62f2f1778a49baba25437e8c624618@derote13de02.global.corp.sap> From: Claus Ibsen Date: Thu, 14 Apr 2016 13:27:47 +0200 Message-ID: Subject: Re: Concerning Attachments and Attachment Headers in Camel To: dev Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Yeah both approaches are doable. But I think the first one is the least invasive and fits 2.x the best. On Thu, Apr 14, 2016 at 11:19 AM, Siano, Stephan wr= ote: > Hi Claus, > > OK, I will file a JIRA task for Camel 3.0 to renovate the attachment hand= ling in the message interface as we discussed below. > > As for the 2.18 extensions: > > What exactly do you mean with "you can try using headers"? > > One option would be to introduce a header (or maybe better an exchange pr= operty) e.g. named "CamelAttachmentHeaders" of type Map> (the first string would be the attachment id and the second one t= he header name, and the third one the header value). The camel-cxf, camel-m= ail (and maybe other) components would have to be extended to populate and = consume these header when attachments are written/read from the camel messa= ge objects. I guess this is possible, but it's quite ugly (and I am unsure = how to keep this consistent). > > A second compatible option would be to create a new Attachment class whic= h extends (and delegates) DataHandler that has an additional Map containing= the headers (with appropriate getters and setters). The components that su= pport this are extended in a way that if they write Attachment objects into= the attachment map of the message and use the headers stored in there if i= t is available. Components that do not support attachment headers should ke= ep working as before. > > Is there a chance that any of these approaches makes it into the main cod= eline? > > Best regards > Stephan > > -----Original Message----- > From: Claus Ibsen [mailto:claus.ibsen@gmail.com] > Sent: Donnerstag, 14. April 2016 09:49 > To: dev > Subject: Re: Concerning Attachments and Attachment Headers in Camel > > On Wed, Apr 13, 2016 at 11:51 AM, Siano, Stephan = wrote: >> Hi Claus, >> >> Sorry for the late reply, but I had to do some thinking about this issue= (and was busy with other things yesterday). >> >> Having the different interfaces for Messages (without attachment) and At= tachment Capable messages (with either implementation option) actually mean= s that we will have message implementations that do support attachments and= other implementations that do not. >> >> With this model we can handle all consumer endpoints. They create Messag= e objects that are attachment capable or not depending on whether the compo= nent supports attachments or not. (File consumers create messages without a= ttachment support, mail(imap) consumers create MailMessages which do suppor= t attachments). >> We can also handle InOnly producer endpoints that do or do not support a= ttachments. If a producer endpoint gets a message that is not attachment ca= pable, there are no attachments. (so the mail(SMTP) producer will not creat= e additional attachments for the outgoing mail if the message is not attach= ment capable and the file producer will just ignore that stuff altogether). >> >> However I see an issue if we have a producer endpoint that is doing InOu= t communication and supports attachments. Examle: we have a route like from= ("file:..").to("cxf:bean:replies_with_an_attachment").to("smtp:mailrelay") >> What is this endpoint type (CXF in the example) supposed to do if it rec= eives a message without attachment supports, sends it out as a request and = then gets a reply containing attachments? Create a new message? As I see it= current message implementations usually do not create new message objects = but only set the headers and bodies on existing ones. Is this a good idea? = What do you think? >> > > Yeah sure there is components that has their own message > implementation such as MailMessage, JmsMessage, etc. The CXF would > then set the OUT as a new CxfMessage where it sets the headers / body > / attachments as it needs. > > > >> Furthermore filing a JIRA task for Camel 3.0 won't help anytime soon. Do= you have any idea about the timeframe of a Camel 3.0 release? I wouldn't e= xpect that anytime soon, but do you think it is realistic to see a Camel 3.= 0 release e.g. next year (or in 2018 or so?). >> > > API changes in Exchange / Message / Processor or whatnot that are > central cannot easily be done on 2.x, and should defer to 3.x. > >> Maybe we can find a way to get attachment headers into the Camel message= in a more compatible way that could be included in Camel 2.18 or so. What = do you think about that? >> > > Yeah you can try using headers > > >> -----Original Message----- >> From: Claus Ibsen [mailto:claus.ibsen@gmail.com] >> Sent: Montag, 11. April 2016 18:32 >> To: dev >> Subject: Re: Concerning Attachments and Attachment Headers in Camel >> >> On Mon, Apr 11, 2016 at 7:45 AM, Siano, Stephan = wrote: >>> Hi Claus, >>> >>> I tend to disagree on that. I actually think that having a generic Atta= chment API in Camel does make sense. Having Attachments only as part of Mai= lMessage and e.g. a (currently non-existing) CXFMessage would mean, that it= is e.g. impossible to receive an attachment via mail and then forward it t= o a SOAP endpoint (using the SOAP with Attachments protocol) even though bo= th endpoint types support attachments. >>> >>> However, you are probably right, that the current solution having the a= ttachments as part of the Message interface is not the best solution for th= at. I guess it would have been better to have either a kind of AttachmentMe= ssage interface (that extends Message) or some kind of AttachmentCapable in= terface (that complements Message). The components supporting attachments c= ould be using this kind of message. However, do you think that this kind of= refactoring makes sense before Camel 3.0? What would be the way to go for = Camel 2.18? >>> >> >> Yeah I like the idea of AttachmentMessage or AttachmentCapable. This >> also makes those components stand out that support attachments. That >> would possible to do for Camel 3.0 where we can do such an API change. >> As its only a few components it wont hurt. >> >> So I suggest to log a JIRA for that for Camel 3.0. >> >> >> >>> Best regards >>> Stephan >>> >>> -----Original Message----- >>> From: Claus Ibsen [mailto:claus.ibsen@gmail.com] >>> Sent: Sonntag, 10. April 2016 15:45 >>> To: dev >>> Subject: Re: Concerning Attachments and Attachment Headers in Camel >>> >>> On Thu, Apr 7, 2016 at 2:42 PM, Siano, Stephan = wrote: >>>> Hi, >>>> >>>> Is there anybody available in this list who knows why the attachment h= andling in Camel is as it is? >>>> >>>> I have had a look into this topic with the Camel-Mail and Camel-CXF co= mponents and would like to discuss my thoughts about that. >>>> >>>> In General the attachment handling is designed to support use cases li= ke MIME-Multipart messages (e.g. in Mail) or attachment formats as SOAP wit= h attachments (e.g in CXF). An attachment usually has some kind of identifi= er, a content type, an attachment body and attachment headers. This is at l= east the case for the Javamail MIME Part (javax.mail.Part) and the CXF mess= age Attachment (org.apache.cxf.message.Attachment) object. >>>> >>>> However the Camel Message interface has a different notion of attachme= nts, there is only a Map with an identifier (a key) and a DataHandler (repr= esenting the message body, the content type and the content disposition). T= herefore there is no representation of any other attachment header. Was tha= t left out on purpose? >>>> >>>> Does it make sense to extend the Camel Message object (org.apache.came= l.Message)? A change here would run rather deep so I would like to discuss = this first before I try to contribute anything in this area. >>>> >>> >>> The attachments are only used in a few components. It was added when >>> Camel was created due the inspiration from JBI / XML world. >>> >>> But today we know better and IMHO the attachments should be >>> deprecated/removed from the generic api, and only those components >>> that want to use it, should have their own. People may mistakenly >>> think that file/ftp/ and other components uses the attachments, but >>> they do not. >>> >>> Then MailMessage and CxfMessage etc can have their attachments api. >>> >>> >>> >>>> Best regards >>>> Stephan >>> >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> http://davsclaus.com @davsclaus >>> Camel in Action 2: https://www.manning.com/ibsen2 >> >> >> >> -- >> Claus Ibsen >> ----------------- >> http://davsclaus.com @davsclaus >> Camel in Action 2: https://www.manning.com/ibsen2 > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 --=20 Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2