Hi,

the name of the xml-element is "mime-multipart", not "mimeMultipart". Can you 
try that?

Best regards
Stephan

-----Original Message-----
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 
Sent: Freitag, 8. Dezember 2017 19:56
To: users@camel.apache.org
Subject: Rép. : RE: camel-mail IMAP mime-multipart splitAttachment

Hi,

i try with 

<split>
       <method 
beanType="org.apache.camel.component.mail.SplitAttachmentsExpression"/>
      <marshal><mimeMultipart/></marshal>
    <to uri="mock:split" />
    <to uri="activemq:queue:jms/XXX/courrielXXXX/reception/queue" />
 </split>

but receive an error into deployement.

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 147 
in XML document from URL 
[bundle://456.1:0/META-INF/spring/bdl.routes_XXX-0.0.1.xml] is invalid; nested 
exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid 
content was found starting with element 'mimeMultipart'.

I don't understand i user Camel 2.17.7, it supposed to be there since 2.17.1  
?????????????


Daniel Langevin








>>> "Siano, Stephan" <stephan.si...@sap.com> 2017-12-08 01:50 >>>

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:daniel.lange...@shq.gouv.qc.ca] 

Sent: Donnerstag, 7. Dezember 2017 19:55
To: users@camel.apache.org 

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";
( '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&amp;password=xxxxxxxxxxx&amp;delete=true&amp;unseen=true&amp;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."


"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."

Reply via email to