On Thu, Nov 29, 2012 at 4:00 PM, Kesireddy, Chandana (ITD)
<[email protected]> wrote:
> Thanks for replying.
> My problem here is , it's not creating .camelLock extension on the file when 
> it is processing the file, using custom GenericFileProcessStrategy.
> What do I need to do in order to make it create .camelLock extension on the 
> file.
>

Write an empty file with that given name. Use the API on java.io.File for that.


> Thanks,
> Chandana
>
> -----Original Message-----
> From: Claus Ibsen [mailto:[email protected]]
> Sent: Thursday, November 29, 2012 7:25 AM
> To: [email protected]
> Subject: Re: creating .camelLock extension on file using custom 
> GenericFileProcessStrategy
>
> On Wed, Nov 28, 2012 at 10:44 PM, Kesireddy, Chandana (ITD) 
> <[email protected]> wrote:
>> Hi,
>>
>> I am writing custom GenericFileProcessStrategy  class .  Iam not able to 
>> create .camelLock extension on the file when it processes the file.
>> I want the file to be deleted after it is processed.
>
> Camel will normally delete .camelLock file automatic when the file is done.
> The file is though not deleted, if Camel crash during processing the file.
>
> In the commit/rollback callbacks you should delete the .camelLock file.
>
>
>
>> Please let me know how to create .camelLock  extension on the file using 
>> using custom GenericFileProcessStrategy. Iam using camel 2.4. I want to 
>> provide options:
>> delete=true,  readLock=changed, readLockTimeout=20000 options applied in my 
>> custom process strategy class.
>> Following is my code:
>>
>> public class CustomProcessStrategy implements
>> GenericFileProcessStrategy{
>>
>>                 @Override
>>                 public boolean begin(GenericFileOperations arg0, 
>> GenericFileEndpoint arg1,
>>                                                 Exchange arg2, GenericFile 
>> arg3) throws Exception {
>>                                 // TODO Auto-generated method stub
>>                                 arg1.setAutoCreate(false);
>>                                 arg1.setDelete(true);
>>                                 arg1.setRecursive(true);
>>                                 arg1.setReadLock("changed");
>>                                 arg1.setReadLockTimeout(20000);
>>                                 System.out.println("in begin..");
>>                                 return true;
>>                 }
>>
>>                 @Override
>>                 public void commit(GenericFileOperations arg0, 
>> GenericFileEndpoint arg1,
>>                                                 Exchange arg2, GenericFile 
>> arg3) throws Exception {
>>                                 // TODO Auto-generated method stub
>>                                 System.out.println("in commit");
>>
>>                 }
>>
>>                 @Override
>>                 public void prepareOnStartup(GenericFileOperations arg0,
>>                                                 GenericFileEndpoint arg1) 
>> throws Exception {
>>                                 System.out.println("prepareOnStartup
>> method..");
>>
>>                                 arg1.setAutoCreate(false);
>>                                 arg1.setDelete(true);
>>                                 arg1.setRecursive(true);
>>                                 arg1.setReadLock("changed");
>>                                 arg1.setReadLockTimeout(20000);
>>
>>                                 System.out.println("end of
>> prepareOnStartup method..");
>>
>>                 }
>>
>>                 @Override
>>                 public void rollback(GenericFileOperations arg0, 
>> GenericFileEndpoint arg1,
>>                                                 Exchange arg2, GenericFile 
>> arg3) throws Exception {
>>                                 // TODO Auto-generated method stu
>>                                 System.out.println("in commit..");
>>                 }
>>
>> }
>>
>> Thanks,
>> Chandana
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [email protected]
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to