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 RE: Rép. : RE: camel-mail IMAP mime-multipart splitAttachment
Date Wed, 13 Dec 2017 02:23:45 GMT
OK finaly i check and mimeMultipart is supposed to be the good spell

Here the definition in camel-spring-2.17.7.xsd

<xs:element name="mime-multipart"
type="tns:mimeMultipartDataFormat"><xs:annotation><xs:documentation
xml:lang="en">
MIME Multipart data format
      </xs:documentation></xs:annotation>
<xs:element name="mimeMultipart" type="tns:mimeMultipartDataFormat"/>
<xs:complexType name="mimeMultipartDataFormat">
<xs:complexContent><xs:extension base="tns:dataFormat">
<xs:sequence/><xs:attribute name="multipartSubType"
type="xs:string"><xs:annotation><xs:documentation xml:lang="en">
Specify the subtype of the MIME Multipart. Default is mixed.. Default
value:
mixed
           
</xs:documentation></xs:annotation></xs:attribute><xs:attribute
name="multipartWithoutAttachment"
type="xs:boolean"><xs:annotation><xs:documentation xml:lang="en">
Defines whether a message without attachment is also marshaled into a
MIME
Multipart (with only one body part). Default is false.. Default value:
false
           
</xs:documentation></xs:annotation></xs:attribute><xs:attribute
name="headersInline" type="xs:boolean"><xs:annotation><xs:documentation
xml:lang="en">
Defines whether the MIME-Multipart headers are part of the message body
(true)
or are set as Camel headers (false). Default is false.. Default value:
false
           
</xs:documentation></xs:annotation></xs:attribute><xs:attribute
name="includeHeaders" type="xs:string"><xs:annotation><xs:documentation
xml:lang="en">
A regex that defines which Camel headers are also included as MIME
headers into
the MIME multipart. This will only work if headersInline is set to
true. Default
is to include no headers
           
</xs:documentation></xs:annotation></xs:attribute><xs:attribute
name="binaryContent" type="xs:boolean"><xs:annotation><xs:documentation
xml:lang="en">
Defines whether the content of binary parts in the MIME multipart is
binary
(true) or Base-64 encoded (false) Default is false.. Default value:
false
           
</xs:documentation></xs:annotation></xs:attribute><xs:anyAttribute
namespace="##other"
processContents="skip"/></xs:extension></xs:complexContent></xs:complexType>


i can't explain why i cant use it ?????? Anyone have clues ?????

Regards 


Daniel


>>> "Siano, Stephan" <stephan.siano@sap.com> 2017-12-12 02:50 >>>
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.langevin@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.siano@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.langevin@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."


"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