Hi, well, the error message means that the JMS endpoints cannot handle binary MIME-Messages. It tries to serialize the message in order to store it, but the data type is not (Java) serializable.
I see two ways how you could proceed. You could either marshal the MIME-Message with attachments into a serialized MIME-Multipart (either with the MIME-Multipart data type or with some settings in the imap-endpoint). This will give you one JMS message containing a MIME-Multipart with message and attachments (similar to the one that goes over the wire in the mail). Or you could convert each of the split parts into something serializable (a byte array or a String if it is text content) before sending it the the JMS queue (convertBodyTo...). Best regards Stephan -----Original Message----- From: Daniel Langevin [mailto:[email protected]] Sent: Donnerstag, 7. Dezember 2017 19:55 To: [email protected] Subject: camel-mail IMAP mime-multipart splitAttachment Hi, i try to implement a MAIL service In OSGI Karaf 4.0.9 with Camel 2.17.7, Camel-Mail and Active-MQ and SQL i want to read MAIL from IMAP server, then keep It into JMS Queue an then process each mail with mime-multipart with attachment and insert it into sql database I stuck at the first Step process read MAIL and insert it into JMS. My Case. I have a MAIL with 2 attachments, i read the MAIL, split it into 2 messages into JMS Queue, each message have a diiferent CamelSplitAttachment Id, corresponding the name of the attachment file, but i don't have the content of my MAIL or of my attachment The body of each split contain: Unknown message type [org.apache.activemq.command.ActiveMQMessage] ActiveMQMessage {commandId = 5, responseRequired = true, messageId = ..... ... ... ... I think i'm the good track, do you have an idea, what is missing ? Only one error/warning in the log message: JmsBinding | 46 - org.apache.camel.camel-jms - 2.17.7 | 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. Thanks! Daniel Here is my bundle. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:cxf="http://camel.apache.org/schema/cxf" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.17.7.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"> <property name="connectionFactory" > <bean class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="userName" value="${activemq.jms.user}"/> <property name="password" value="${activemq.jms.password}"/> </bean> </property> </bean> <camelContext xmlns="http://camel.apache.org/schema/spring" trace="false"> <route id="route.UTL.Imap"> <from uri="direct:UTL.IMAP"/> <from uri="imaps://servername:993?username=xxxxxxxxxxxx&password=xxxxxxxxxxx&delete=true&unseen=true&consumer.delay=20000" /> <split> <method beanType="org.apache.camel.component.mail.SplitAttachmentsExpression"/> <to uri="mock:split" /> <to uri="activemq:queue:jms/SDI/courrielSystemeSHQ/reception/queue" /> </split> <log message="*** MAIL RECEIVE ${body} ***"/> </route> .... .... .... </camelontext> "Le pr?sent courriel peut contenir des renseignements confidentiels et ne s'adresse qu'au destinataire dont le nom appara?t ci-dessus. Si ce courriel vous est parvenu par m?garde, veuillez le supprimer et nous en aviser aussit?t."
