Hi, I followed your advices and now it works:
In first I tried to force to convert the body: <convertBodyTo type="String" />. but it doesn't work because the message is of type MultiPart. So I took a look of the source code of camel in order to know how the body in mail was setted and I saw the real body is included inside the first bodyPart of the MultiPart message. So I created a very simple processor named ImapProcessor: public class ImapProcessor implements Processor { private final static Logger LOG = LoggerFactory.getLogger(ImapProcessor.class); public void process(Exchange arg0) throws Exception { MimeMultipart multipartBody = (MimeMultipart) arg0.getIn().getBody(); Object content = multipartBody.getBodyPart(0).getContent(); LOG.debug("[IMAP PROCESSOR] body content {}", content); arg0.getIn().setBody(content.toString()); } } For now the processor doesn't deal with attachments (there is already a good example inside the camel documentation). In camel.xml configuration I just added: <bean id="imapProcessor" class="com.kiengi.mail.processor.ImapProcessor"/> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <jmxAgent id="agent" disabled="true"/> <route> <from uri="imaps:// imap.gmail.com?username=test...@gmail.com&password=xxxxxxxx&delete=false&unseen=true&debugMode=true" /> <process ref="imapProcessor"/> <to uri="activemq:Q1.mail" /> </route> </camelContext> And don't forget to add the jar containing the class inside the lib directory of activemq. Now in the activemq console I can see the body of the mail inside the body of the jmsMessage. And now it works like a charm. Thank you very much for your help. 2012/1/16 Nicolas Gapaillard <nicolas.gapaill...@gmail.com> > Hi, > > Thank you for your answer I will try all your suggestions. > > > > > 2012/1/13 Raul Kripalani <r...@fusesource.com> > >> Hi >> >> Try explicitly converting the body to a String by using <convertBodyTo >> type="String" />. >> >> Having said that it looks like the content of your mail message is not >> simple text (i.e. mime type is not text/plain), rather Multipart, so you >> may have to implement a processor or use expression languages to extract >> the relevant information from the javax.mail.MimeMultipart object by using >> the standard API ( >> http://docs.oracle.com/javaee/5/api/javax/mail/internet/MimeMultipart.html >> ). >> >> Hope that helps. >> >> Regards, >> Raúl. >> >> On 13 January 2012 08:25, Nicolas Gapaillard >> <nicolas.gapaill...@gmail.com>wrote: >> >> > Hi all, >> > >> > I sent the same message on activeMQ ML and I didn't have any answer. My >> > problem is between camel and activeMQ. >> > >> > Maybe i will be more lucky here. >> > >> > I succeed to send an imap message from camel to activemq. But I have a >> > problem, I have all information except the body. >> > >> > My camel configuration inside activeMQ: >> > >> > <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> >> > <jmxAgent id="agent" disabled="true"/> >> > <route> >> > <from uri="imaps:// >> > >> > >> imap.gmail.com?username=testest.activ...@gmail.com&password=xxxxxxx&delete=false&unseen=true<http://imap.gmail.com?username=testest.activ...@gmail.com&password=xxxxxxx&delete=false&unseen=true> >> > < >> > >> http://imap.gmail.com/?username=testest.activ...@gmail.com&password=xxxxxxx&delete=false&unseen=true >> > >" >> > /> >> > <to uri="activemq:Q1.mail" /> >> > </route> >> > </camelContext> >> > >> > <!-- configure the camel activemq component to use the current broker >> --> >> > <bean id="activemq" >> > class="org.apache.activemq.camel.component.ActiveMQComponent"> >> > <property name="connectionFactory"> >> > <bean class="org.apache.activemq.ActiveMQConnectionFactory"> >> > <property name="brokerURL" >> > value="vm://localhost?broker.persistent=false&broker.useJmx=false"/> >> > </bean> >> > </property> >> > </bean> >> > >> > From activemq side I have this message when I consume the email from the >> > imap server : >> > >> > Cannot determine specific JmsMessage type to use from body class. Will >> use >> > generic JmsMessage. Body class: javax.mail.internet.MimeMultipart. If >> you >> > want to send a POJO then your class might need to implement >> > java.io.Serializable, or you can force a specific type by setting the >> > jmsMessageType option on the JMS endpoint. >> > >> > I guess the object javax.mail.internet.MimeMultipart sent by camel is >> not >> > serializable. >> > The message I receive in my JMS client: >> > >> > ActiveMQMessage {commandId = 5, responseRequired = true, messageId = >> > ID:plop-laptop-42681-1326258465826-2:1:1:1:1, originalDestination = >> null, >> > originalTransactionId = null, producerId = >> > ID:plop-laptop-42681-1326258465826-2:1:1:1, destination = >> queue://Q1.mail, >> > transactionId = null, expiration = 0, timestamp = 1326258534134, >> arrival = >> > 0, brokerInTime = 1326258534135, brokerOutTime = 1326258534159, >> > correlationId = null, replyTo = null, persistent = true, type = null, >> > priority = 4, groupID = null, groupSequence = 0, targetConsumerId = >> null, >> > compressed = false, userID = null, content = null, marshalledProperties >> = >> > org.apache.activemq.util.ByteSequence@1ebf1eb, dataStructure = null, >> > redeliveryCounter = 0, size = 0, properties = >> > {Authentication_HYPHEN_Results=mr.google.com; spf=pass (google.com: >> domain >> > of >> > p...@gmail.com designates 10.224.31.202 as permitted sender) >> > smtp.mail=p...@gmail.com; dkim=pass >> > header.i=p...@gmail.com, Return_HYPHEN_Path=<p...@gmail.com>, >> > MIME_HYPHEN_Version=1.0, Message_HYPHEN_ID=< >> > cajef+7teg9e9-osuch+oze+guznijvvm7pfcyntqp-yr9y2...@mail.gmail.com>, >> > Content_HYPHEN_Type=multipart/alternative; >> > boundary=20cf3074b14c4bc59604b639a0c8, Date=Wed, 11 Jan 2012 06:08:45 >> > +0100, Subject=mail de test, To=testest.activ...@gmail.com, >> > Delivered_HYPHEN_To=test...@gmail.com, From=Plop <p...@gmail.com>, >> > DKIM_HYPHEN_Signature=v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com >> ; >> > s=gamma; >> > h=mime-version:date:message-id:subject:from:to:content-type; >> > bh=tDZGQ2Ys4OH/ioEN81r3vKi/8ccflSm+mOzJ5phR/eU=; >> > b=iWW9RdyTl6EL7q4vnHtrOlBGEhmDgTjdoed4bdxEPdTboLeNQGPsmR5BIDKT1ZxOse >> > oQHpVKxt8PJFPP7MkOlyveumuiiXo+VJr3Z8rso2ZRJyEzU5CIOfXnv89Mvk1Z50UfGB >> > YyuRbavP8ZYd47aGZHlKIzEhjwGLfRDDSycwk=, Received_HYPHEN_SPF=pass ( >> > google.com: domain of p...@gmail.com >> > designates 10.224.31.202 as permitted sender) >> client-ip=10.224.31.202;}, >> > readOnlyProperties = true, readOnlyBody = true, droppable = false} >> > >> > >> > >> > How can I do to fix or work around this problem between camel and >> activemq >> > ? If someone has an idea. >> > >> > Thank you for your help. >> > >> > -- >> > Nicolas Gapaillard >> > nicolas.gapaill...@gmail.com >> > >> > > > > -- > Nicolas Gapaillard > nicolas.gapaill...@gmail.com > > > -- Nicolas Gapaillard nicolas.gapaill...@gmail.com