You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bbuzzard <Bi...@bnsflogistics.com> on 2011/08/29 20:48:15 UTC

What are the differences between using preMove and readLock=rename

Both of these functions seem like they are doing basically the same thing. 
What are the advantages and disadvantages of using one method verses the
other?



--
View this message in context: http://camel.465427.n5.nabble.com/What-are-the-differences-between-using-preMove-and-readLock-rename-tp4747269p4747269.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: What are the differences between using preMove and readLock=rename

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Aug 30, 2011 at 2:03 PM, bbuzzard
<Bi...@bnsflogistics.com> wrote:
> When I first read your response I guess I missed the part about preMove
> happens after the readLock has determined it's ok to consume the file.  So
> if readLock=none then it might be possible for the preMove to move a file
> that was still being written to.  Is that correct?
>

Yes.

The readLock also have a timeout option, so you can have Camel wait a
bit trying to obtain the read-lock.

And only of the lock is acquired, Camel will process the file, which
means only at this point in time,
the preMove is being executed.




> --
> View this message in context: http://camel.465427.n5.nabble.com/What-are-the-differences-between-using-preMove-and-readLock-rename-tp4747269p4749777.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: What are the differences between using preMove and readLock=rename

Posted by bbuzzard <Bi...@bnsflogistics.com>.
When I first read your response I guess I missed the part about preMove
happens after the readLock has determined it's ok to consume the file.  So
if readLock=none then it might be possible for the preMove to move a file
that was still being written to.  Is that correct?

--
View this message in context: http://camel.465427.n5.nabble.com/What-are-the-differences-between-using-preMove-and-readLock-rename-tp4747269p4749777.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: What are the differences between using preMove and readLock=rename

Posted by bbuzzard <Bi...@bnsflogistics.com>.
Except for the fact that readLock=rename does a rename in the current folder
and preMove basically does a rename (move) to a different folder there seems
to be no real difference between the two.  readlock=rename is performed
before any other operation is performed, but so is preMove.  I was hoping
you might tell me that one function was better than the other in a
particular situation.

The only real difference that I can detect is that if preMove is successful
it will have moved the file into a new directory where it should be safe
from overwrite and readLock=true does not.  

--
View this message in context: http://camel.465427.n5.nabble.com/What-are-the-differences-between-using-preMove-and-readLock-rename-tp4747269p4749764.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: What are the differences between using preMove and readLock=rename

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

readLock is a locking feature. This comes before any processing of the
file. At first Camel needs to obtain a lock on the file.
For that you can use different locking strategies. One of these is
readLock=rename. This will do a IO rename of the file, and then rename
the file back again. This is based on the assumption a lock can be
obtained on the file, if you could do a IO rename on the file.


preMove is part of the process where Camel got the read lock on the
file, and is about to process the file.
The preMove option will just move the file *before* the file is
processed. For example some use cases requires you to move in progress
files to a specific folder etc. This is what you can use this option
for.



On Mon, Aug 29, 2011 at 8:48 PM, bbuzzard
<Bi...@bnsflogistics.com> wrote:
> Both of these functions seem like they are doing basically the same thing.
> What are the advantages and disadvantages of using one method verses the
> other?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/What-are-the-differences-between-using-preMove-and-readLock-rename-tp4747269p4747269.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/