Hi Jane,
I make a little test with my environment Camel version 3.14.3 running into
karaf 4.3.3
Here a simple rest service extract from a blueprint deployment and it works
very well, with and without an attachment !!!!
<rest path="/readMail" produces="application/json" >
<description>TTT - Poll imap read With PollEnrich</description>
<get uri="/">
<route id="rte.TTT.rest.readMail" >
<pollEnrich >
<simple>imaps://{{SHQ_imap_server}}?username={{SHQ_imap_user}}&password={{SHQ_imap_pwd}}&delete=true&unseen=true&peek=true&mapMailMessage=true&closeFolder=false&debugMode=true</simple>
</pollEnrich>
<setHeader name="zzLOG"><groovy>
import javax.activation.DataHandler;
import org.apache.camel.attachment.*;
AttachmentMessage attachmentMessage =
exchange.getMessage(AttachmentMessage.class);
Map<String, DataHandler> attachments =
attachmentMessage.getAttachments();
if (attachments != null) {
result="Yes attachment";
} else {
result="No attachment";
}
</groovy></setHeader>
<log message="Attachment ? = ${header.zzLOG}"/>
</route>
</get>
</rest>
Regards
Daniel
-----Message d'origine-----
De : Mi Jane 米静 <[email protected]>
Envoyé : 1 septembre 2022 00:31
À : [email protected]
Objet : RE: Poll enrich with mail component will lose attachments
Hi Claus, Hi Daniel,
Thanks for your reply!
I tried Camel 3.18.X and “&disconnect=false”. It’s still not working.
Regards,
Jane
From: Mi Jane 米静
Sent: Wednesday, August 31, 2022 4:29 PM
To: [email protected]
Subject: Poll enrich with mail component will lose attachments
Dear community,
When I used Camel 3.11, poll enrich with mail component worked well and I could
get the mail attachments.
When I changed to Camel 3.16 for other reasons, I could get the mail but I
couldn’t get the attachments.
Here is an example:
……
.pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&unseen=true&peek=true&folderName={{mail.sub.folder}}")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
AttachmentMessage attachmentMessage =
exchange.getMessage(AttachmentMessage.class);
Map<String, DataHandler> attachments =
attachmentMessage.getAttachments();
if (attachments != null) {
LOGGER.info("attachments: {}",
attachments.size());
} else {
LOGGER.info("no attachment");
}
}
})
……
With Camel 3.11 I got log “attachments: 1”, while with Camel 3.16 I got log “no
attachment”.
Is it a known issue for Camel 3.16, or is there any extra parameter I missed?
Thanks in advance!
Regards,
Jane