On Sat, Jul 25, 2009 at 9:14 PM, tide08<[email protected]> wrote: > > Sorry, I was not clear enough.. > > As as example, using 1.5 for below scenario, handling attachments is > difficult. > > from("activemq:some.queue") > .to("velocity:someTemplate.vm") > .to("smtp://sendm...@localhost") > > While client sends the message with attachments, since those are not > supported by JMS component, it will get lost. So 2 options, either you send > attachments as body or headers. JMS component only supports primitive > headers so adding attachment is ruled out. If you send attachment as body, > you have to make sure attachments are set in headers back again otherwise > velocity component will overwrite it and would be lost. > > I hope I am talking sane here, and have not missed something obvious :) >
Many transports do not support Attachments, in fact its really only JBI and Mail that does support it as part of the transport. Me personally would never have added the Attachments API to the Camel Exchange API as it gives this impression that it kinda works magically with any transports. But of course it does not. Camel can never be in the role to ensure that attachments can be transfered safely without interfering with the various transports protocols. For instance how would you send attachments over TCP sockets? And what should happen when Camel is not acting as both client and server? So you have to deal with this issue yourself and store attachments according to the transports you use. So do not expect any improvements in Camel 2.0 or that a magic wand comes by and makes all the various transports and protocols in the world suddenly know the notion of an attachment. You can however try the transferExchange=true option on the JMS component in Camel. Then it sends the entire Exchange over JMS and this should also keep the attachments if you use Camel on both the client and server side. Otherwise you can create your own POJO format to keep the message body and attachments separated and send it as a ObjectMessage over JMS. TransferExchange is new in Camel 2.0: http://camel.apache.org/jms.html > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Can you be a bit more specific? Attachements is not supported natively >> by many transports/protocols. >> So I would like to know how and where you use it? >> >> >> >> On Fri, Jul 24, 2009 at 1:15 AM, tide08<[email protected]> wrote: >>> >>> I was wondering if attachments would be handled graciously across all the >>> components in 2.0. Currently in 1.5 I have to juggle up attachments from >>> headers to body depending on components. It is kind of hard to deal with >>> attachments, should we expect better support in 2.0? >>> >>> Thanks! >>> -- >>> View this message in context: >>> http://www.nabble.com/Attachment-support-in-2.0-tp24636245p24636245.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://www.nabble.com/Attachment-support-in-2.0-tp24636245p24660801.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
