[ 
https://issues.apache.org/jira/browse/CAMEL-20907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17860054#comment-17860054
 ] 

kangjian edited comment on CAMEL-20907 at 6/26/24 3:02 AM:
-----------------------------------------------------------

Hi [~davsclaus] , sorry, the 3.22.x version is no problem, it's the reason for 
my code, I found 
jira[CAMEL-19675|https://issues.apache.org/jira/browse/CAMEL-19675] to fix this 
bug.

Thank you very much for your help.


was (Author: JIRAUSER305880):
Hi [~davsclaus] , sorry, the 3.22.x version is no problem, it's the reason for 
my code, I found jiraCAMEL-19675 to fix this bug.

Thank you very much for your help.

> came-mail - In Poll Enrich EIP, get email attachments are empty
> ---------------------------------------------------------------
>
>                 Key: CAMEL-20907
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20907
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 3.18.0
>            Reporter: kangjian
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.x
>
>
> Let's say I need to wait for an event notification and then pull an 
> attachments email like this:
> Camel version 3.18.x
> {code:java}
> from("servlet://foo?servletName=MyServlet")
> .loopDoWhile().simple("${exchangeProperty.CamelBatchComplete} == null || 
> ${exchangeProperty.CamelBatchComplete} == false")
> .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&peek=true&folderName={{mail.sub.folder}}&sendEmptyMessageWhenIdle=true")
> .process(exchange -> {
> AttachmentMessage attachmentMessage = exchange.getIn(AttachmentMessage.class);
> // Here attachments is null
> Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
> })
> .end();{code}
>  
> Same code, works fine in Camel 3.14.x but doesn't work in Camel 3.18.x.
> After debugging, it was found that in Camel 3.16.x, the implementation of 
> DefaultAttachmentMessage.java was upgraded.
> The key point is the CamelAttachmentObjects property in the ExchangeProperty, 
> which is placed in the Exchange property in version 3.14.x, and in the 
> ExtendedExchange property in version 3.16.x, which results in the loss of the 
> CamelAttachmentObjects property between different Exchange.
> Details can be found in the link below line 274:
> [https://github.com/apache/camel/commit/0125a133a11cbdff57d459634bac276c10963387]
> I tried a solution as follows:
> Camel version 3.18.x
> {code:java}
> from("servlet://foo?servletName=MyServlet")
> .loopDoWhile().simple("${exchangeProperty.CamelBatchComplete} == null || 
> ${exchangeProperty.CamelBatchComplete} == false")
> .pollEnrich("imaps://{{mail.server}}?session=#oAuthSession&closeFolder=false&peek=true&folderName={{mail.sub.folder}}&sendEmptyMessageWhenIdle=true",
> ((oldExchange, newExchange) -> {
> // Deliver the attachment to the oldExchange
> oldExchange.setIn(newExchange.getIn(AttachmentMessage.class));
> return oldExchange;
> }))
> .process(exchange -> {
> AttachmentMessage attachmentMessage = exchange.getIn(AttachmentMessage.class);
> Map<String, DataHandler> attachments = attachmentMessage.getAttachments();
> })
> .end(); {code}
> The above can solve the problem of not being able to get attachments, but 
> there will be other properties missing.
> Can you help with this? If information is missing, please do not hesitate to 
> contact.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to