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

Claus Ibsen commented on CAMEL-7565:
------------------------------------

Yeah the disconnect logic should be moved to an UoW instead of post poll check. 
Though the trick is to only disconnect on the last Exchange, eg in case the 
consumer polled 5 files, then the disconnect should only happen on the last 
UoW. And that gets more complicated if the exchanges is processed in parallel 
and asynchronous. Then you could have that even the last file polled was not 
last processed, but maybe it was the 3rd file etc.

But for a single file, such as you may use with pollEnrich then there is only 1 
exchange and therefore a bit easier.



> SFTP using PollEnrich with "disconnect=true" and "delete=true" does NOT 
> delete the file
> ---------------------------------------------------------------------------------------
>
>                 Key: CAMEL-7565
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7565
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.13.1
>         Environment: Occurs on both Windows 7 and CentOS 6.4 against multiple 
> SFTP servers.
>            Reporter: Steve Ardis
>            Assignee: Claus Ibsen
>            Priority: Minor
>              Labels: delete, disconnection, pollenrich, sftp
>             Fix For: 2.13.3, 2.14.0
>
>         Attachments: SftpPollEnrichConsumeWithDisconnectAndDeleteTest.java, 
> SftpSimpleConsumeWithDisconnectAndDeleteTest.java
>
>
> Attached are two test cases - one with a "non-pollEnrich" test (which works 
> fine) and one with a "pollEnrich" test (which fails).
> In stepping through some of the code, it appears that the "disconnect" and 
> "delete" are on two different threads (true for both scenarios).  However, 
> for the "non-pollEnrich" test, there seems to be a cycle that allows the 
> timing of the two threads to NOT be an issue.  For the "pollEnrich" test, 
> that cycle doesn't seem to occur.  
> My uneducated guess is that both tests (code executions) are checking to see 
> if the "from" has completed (including performing the delete) before 
> disconnecting.  This makes sense for the "non-pollEnrich" test, but for the 
> "pollEnrich" it should be checking to see if the "pollEnrich" is done, not 
> the "from".
> Please note that if you do not indicate "disconnect=true", file deletion 
> occurs as expected.  This seems to be broken in 2.12.x through 2.13.1 (not 
> sure if it goes back further or not).
> I have attached two different test cases to show the different behaviors 
> ("non-pollEnrich" vs "pollEnrich").



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to