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.

Reply via email to