camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Langevin" <daniel.lange...@shq.gouv.qc.ca>
Subject camel-mail IMAP mime-multipart splitAttachment
Date Thu, 07 Dec 2017 18:55:10 GMT
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&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."

Mime
View raw message