[
https://issues.apache.org/jira/browse/CAMEL-8954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14623906#comment-14623906
]
Andy Fedotov commented on CAMEL-8954:
-------------------------------------
Currently in our project we actively use file/sftp components and similar
use-cases with poll-enrich pattern. There are no any problem with locking
because it is not needed at all, we are using *readLock=none*.
Maybe this has no really serious impact and has no actual use-cases, but such
locking strategy design seems slightly wrong. When I tried to implement my own
custom processor bean to handle poll-enrich, I also tried to figure out how to
+correctly+ deal with Exchange UoW and synchronizations, and stumbled on this
problem. I thought that I was doing something wrong, because lock files are not
gone after route completion.
Just in case, I also stuck on that MarkerFileExclusiveReadLockStrategy is
intended as kind of cross-route/JVM lock sharing. But
MarkerFileExclusiveReadLockStrategy.prepareOnStartup() is blindly deletes all
created *.camelLock files on every Consumer creation and startup.
> Lock information is not handovered together with Exchange on-completion
> synchronizations
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-8954
> URL: https://issues.apache.org/jira/browse/CAMEL-8954
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.14.3
> Reporter: Andy Fedotov
> Priority: Minor
> Attachments: MarkerFileExclusiveReadLockStrategyUnlockTest.java
>
>
> This applies to the file components when using common read-lock strategies:
> - *markerFile* -
> org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy
> - *fileLock* -
> org.apache.camel.component.file.strategy.FileLockExclusiveReadLockStrategy
> This strategies stores lock information in the Exchange properties:
> - *Exchange.FILE_LOCK_FILE_ACQUIRED* == "CamelFileLockFileAcquired"
> - *Exchange.FILE_LOCK_FILE_NAME* == "CamelFileLockFileName"
> - *Exchange.FILE_LOCK_EXCLUSIVE_LOCK* == "CamelFileLockExclusiveLock"
> - *Exchange.FILE_LOCK_RANDOM_ACCESS_FILE* == "CamelFileLockRandomAccessFile"
> Lock information is stored as scalar values and can hold information about
> _only one single lock_.
> When there are two Exchanges participates in the route, share UoW, and
> synchronizations are handovered from one Exchange to another, information
> about both locks can't be stored in the Exchange properties and lost.
> Consequently when on-completion synchronizations are performed, read-lock
> strategies can't access information about all the locks and they are not
> released.
> For example, after completing this route lock for file1.dat is not released:
> {code:java}
> from("file:data/input-a?fileName=file1.dat&readLock=markerFile")
> .pollEnrich("file:data/input-b?fileName=file2.dat&readLock=markerFile")
> .to("mock:result");
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)