You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "richie.riviere@gmail.com" <ri...@gmail.com> on 2013/12/01 02:14:46 UTC

CamelLock file being created and not sure why

Hi,

I have a route that grabs files from an input directory, does some
operations and then moves files to another directory.

The route works well and my file is moved post processing. My issue is that
a camelLock file gets left in the source directory after processing. I read
somewhere in the camel forums that you need to set the unit of work is done
to complete this and I've tried this (see route below where I add a
processor after the last operation in my route) but it didn't work and it
didn't make sense to do that either. 

Can anyone help me out please.

thanks

Here is what the route looks like.

     	from("file:src/inbox/items/?preMove=processed&move=done") 
			.process(new Processor() {
			    public void process(Exchange exchange) throws Exception {			        
			        String filename = (String)
exchange.getIn().getHeader(CamelConstants.HEADER_KEY_CAMEL_FILE_NAME);
			        String body = exchange.getIn().getBody(String.class);
			        ImportPayloadEntity importPayloadEntity = new
ImportPayloadEntity();
			        importPayloadEntity.setPayloadType(DaoConstants.ITEM_PAYLOAD);
			        importPayloadEntity.setPayloadBody(body);
			        importPayloadEntity.setFilename(filename);
			        importPayloadEntity.setLoadDateTime(new Date());
			        importPayloadEntity.setProcessedInd(DaoConstants.NOT_PROCESSED);
			        importPayloadEntity.setProcessedDatetime(null);
			       
exchange.getIn().setHeader(CamelConstants.HEADER_KEY_IMPORT_PAYLOAD,
importPayloadEntity);
			    }
			}) 
            .convertBodyTo(
            		ItemDocument.class)             
			.to("jpa:org.apache.camel.etl.entity.ImportPayloadEntity")
			.process(new Processor() {
			    public void process(Exchange exchange) throws Exception {			        
			        exchange.getUnitOfWork().done(exchange);
			    }
			});



--
View this message in context: http://camel.465427.n5.nabble.com/CamelLock-file-being-created-and-not-sure-why-tp5744115.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelLock file being created and not sure why

Posted by "richie.riviere@gmail.com" <ri...@gmail.com>.
actually scrap that. the problem is back...lol



--
View this message in context: http://camel.465427.n5.nabble.com/CamelLock-file-being-created-and-not-sure-why-tp5744115p5744118.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelLock file being created and not sure why

Posted by "richie.riviere@gmail.com" <ri...@gmail.com>.
Well I don't know what I did but the problem seems to be gone now. I didn't
do anything to fix it. Maybe it was a resource thing relating to me having
it open somewhere else?



--
View this message in context: http://camel.465427.n5.nabble.com/CamelLock-file-being-created-and-not-sure-why-tp5744115p5744117.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelLock file being created and not sure why

Posted by "richie.riviere@gmail.com" <ri...@gmail.com>.
I'm using 2.11. Its strange. Sometime it's happening and other times it
doesn't.

thanks



--
View this message in context: http://camel.465427.n5.nabble.com/CamelLock-file-being-created-and-not-sure-why-tp5744115p5744121.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelLock file being created and not sure why

Posted by Claus Ibsen <cl...@gmail.com>.
You should not need to call the UoW done manually. Just remove that
and let Camel handle that internally.

What version of Camel do you use?
And where is the .camelLock file placed? In what directory?

And as usual try upgrade your Camel to see if this helps.

On Sun, Dec 1, 2013 at 2:14 AM, richie.riviere@gmail.com
<ri...@gmail.com> wrote:
> Hi,
>
> I have a route that grabs files from an input directory, does some
> operations and then moves files to another directory.
>
> The route works well and my file is moved post processing. My issue is that
> a camelLock file gets left in the source directory after processing. I read
> somewhere in the camel forums that you need to set the unit of work is done
> to complete this and I've tried this (see route below where I add a
> processor after the last operation in my route) but it didn't work and it
> didn't make sense to do that either.
>
> Can anyone help me out please.
>
> thanks
>
> Here is what the route looks like.
>
>         from("file:src/inbox/items/?preMove=processed&move=done")
>                         .process(new Processor() {
>                             public void process(Exchange exchange) throws Exception {
>                                 String filename = (String)
> exchange.getIn().getHeader(CamelConstants.HEADER_KEY_CAMEL_FILE_NAME);
>                                 String body = exchange.getIn().getBody(String.class);
>                                 ImportPayloadEntity importPayloadEntity = new
> ImportPayloadEntity();
>                                 importPayloadEntity.setPayloadType(DaoConstants.ITEM_PAYLOAD);
>                                 importPayloadEntity.setPayloadBody(body);
>                                 importPayloadEntity.setFilename(filename);
>                                 importPayloadEntity.setLoadDateTime(new Date());
>                                 importPayloadEntity.setProcessedInd(DaoConstants.NOT_PROCESSED);
>                                 importPayloadEntity.setProcessedDatetime(null);
>
> exchange.getIn().setHeader(CamelConstants.HEADER_KEY_IMPORT_PAYLOAD,
> importPayloadEntity);
>                             }
>                         })
>             .convertBodyTo(
>                         ItemDocument.class)
>                         .to("jpa:org.apache.camel.etl.entity.ImportPayloadEntity")
>                         .process(new Processor() {
>                             public void process(Exchange exchange) throws Exception {
>                                 exchange.getUnitOfWork().done(exchange);
>                             }
>                         });
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CamelLock-file-being-created-and-not-sure-why-tp5744115.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen