[ 
https://issues.apache.org/jira/browse/CAMEL-5376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexis Kinsella updated CAMEL-5376:
-----------------------------------

    Attachment: MailConsumer.java

Hi, I tried to find some nice workaround, but it is a little bit tricky due to 
the way pop3 messages are deleted through close of the folder.

I ended by fixing the issue with a CountDownLatch on the number of exchanges to 
process before closing resources. CountDownLatch is decremented on completion 
of exchange
At the end of poll the countdownlatch timeouts if await time is not over, and 
therefore never locks the consumer. 
I added a timeout having for duration the delay of the timer, maybe there 
should be a new configuration property dedicated to this new value.

By the way, all messages are correctly deleted on each poll, and the fix rely 
mainly on the fact that release of resources is done after completion of the 
process of last message.

I added some guarding on countdownlatch to avoid poll if countdownlatch is not 
null, it should not happen since countdownlatch is nulled on finally clause.

I hope it will help to improve mail components. 

Best regards,

Aleixs
                
> Mail component does not work as expected (Email Deletion is partially broken 
> et Disconnect does not work well)
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5376
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5376
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 2.9.1
>         Environment:  - Exchange, but should happen with any mail server, 
> since it is not directly related to (See above)
>  - Apache James Server 3.X
>            Reporter: Alexis Kinsella
>         Attachments: MailConsumer.java
>
>
> The way disconnect is implemented causes issues with some other options of 
> the consumer. For instance "disconnect" option is not compatible with 
> "delete" option.
> The delete action is done in completion action (processCommit: line 185). On 
> line 305, processCommit method checks if folder is open, but "disconnect" 
> option force folder at null value at the end of poll method (Line 149).
> I guess disconnect method should be called on completion after any other 
> completion actions occured: It is not possible to make completion actions if 
> connection to mail server is closed.
> The result of the usage of disconnect option and delete option is a 
> NullPointerException on test: "if (!folder.isOpen())" statement on line 308.
> Issue should be always reproductible.
> I let you fix the priority of the issue, but it is an annoying issue even if 
> there is a workaround by disabling disconnect option ...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to