camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexis Kinsella (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-5376) Mail component does not work as expected (Email Deletion is partially broken et Disconnect does not work well)
Date Fri, 14 Dec 2012 15:04:13 GMT

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

Alexis Kinsella edited comment on CAMEL-5376 at 12/14/12 3:03 PM:
------------------------------------------------------------------

Hi, here are some news about this issue.

Let me restart some explanations about some issues on mail consumer.

First problem:

 * When you consume mails with delete option enabled, mails consumed will be marked with DELETED
flag on completion callback. Not sure, but I guess completion is async since it happens at
the end of exchange processing. Anyway, mail deletion is effective on folder close. 

Folder close action is triggered in method _poll_, just after _processBatch_ method call which
is in charge of processing mails. Therefore message completion, which mark messages as deleted,
may happen after folder close which is in charge of sending deleted information back to the
mail server.

As a consequence some messages may remain deleted in inflight messages, but instruction is
never sent back to mail server. 

Folder close (and deletion of messages) should happen after completion of last message. If
you try to stop a route with inflight messages, you get a gracefull shutdown with 300 seconds
to wait.

Do you think process of mail deletion can be improved ? -> Is it possible to safely close
folder after completion of messages ?

Or can you let open folder as long as connection is open or something like that ?

In case you want to ease your tests, I developped some tooling to bootstrap an in memory pop3
server based on Apache James Server. You can easily check behaviors of each sides. Source
code is here: https://github.com/akinsella/pop3-mock-server

My testing protocol is the following : 
 - Start pop3 mock server with 100 mails injected in mail box: 
 - Start a Camel context that consume 5 mails at a time, mail is sent on some simple route
forwarding message to some ActiveMQ JMS queue.
 from("pop3://jode@localhost:9110?debugMode=true&fetchSize=5&delete=true&consumer.delay=1000&connectionTimeout=20000&mapMailMessage=false")
   .to("activemq:queue:someQueue");
 - On first poll, you can check with debug of MailConsumer that usualy at least one message
is not deleted on server (Server receives 4 delete commands instead of 5 expected), and therefore
one message stay inflight

disconnect=true option is also broken due to the sync close of folder and connection  and
async process of message deletion.

You can mail me if you have any question.

Best regards,

Alexis

                
      was (Author: alexiskinsella):
    Hi, here are some news about this issue.

Let me restart some explanations about some issues on mail consumer.

First problem:

 * When you consume mails with delete option enabled, mails consumed will be marked with DELETED
flag on completion callback. Not sure, but I guess completion is async since it happens at
the end of exchange processing. Anyway, mail deletion is effective on folder close. 

Folder close action is triggered in method _poll_, just after _processBatch_ method call which
is in charge of processing mails. Therefore message completion, which mark messages as deleted,
may happen after folder close which is in charge of sending deleted information back to the
mail server.

As a consequence some messages may remain deleted in inflight messages, but instruction is
never sent back to mail server. 

Folder close (and deletion of messages) should happen after completion of last message. If
you try to stop a route with inflight messages, you get a gracefull shutdown with 300 seconds
to wait.

Do you think process of mail deletion can be improved ? -> Is it possible to safely close
folder after completion of messages ?

Or can you let open folder as long as connection is open or something like that ?

In case you want to ease your tests, I developped some tooling to bootstrap an in memory pop3
server based on Apache James Server. You can easily check behaviors of each sides. Source
code is here: https://github.com/akinsella/pop3-mock-server

My testing protocol is the following : 
 - Start pop3 mock server with 100 mails injected in mail box: 
 - Start a Camel context that consume 5 mails at a time, mail is sent on some simple route
forwarding message to some ActiveMQ JMS queue.
 from("pop3://jode@localhost:9110?debugMode=true&fetchSize=5&delete=true&consumer.delay=1000&connectionTimeout=20000&mapMailMessage=false")
   .to("activemq:queue:someQueue");
 - On first poll, you can check with debug of MailConsumer that usualy at least one message
is not deleted on server (Server receives 4 delete commands instead of 5 expected), and therefore
one message stay inflight

disconnect=true option is also broken due to the sync close of folder and connection  and
async process of message deletion.

Mail me if you have any question.

                  
> 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
>
> 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

Mime
View raw message