camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: ConsumerTemplate not finishing?
Date Wed, 08 Sep 2010 06:59:05 GMT

Ah I took a look at your code and of course you have a catch-22 situation.

You consume a file and want it as a File instance (which is just a
handle for a file). and then you want that file deleted.
This means your file handle would point to a deleted file.

What you could do is to return the file as a String which means the
content of the file is read into memory.
Then Camel could delete the file.

On Fri, Aug 20, 2010 at 4:15 PM, Andreas Asmuss <> wrote:
> Hi
> I have a route where I call this bean. The consumer gets the file and
> everything is OK except the file is not deleted. There is also a .camelLock
> file which is left behind at every run. So isn't the consumer finishing up,
> or what could be wrong?
> public class CustomEnricher {
>        public void enrich(Message m, @XPath("/root/rsp/text()") String path,
> CamelContext ctx) {
>                ConsumerTemplate consumer = ctx.createConsumerTemplate();
>                File file = consumer.receiveBody("file:data?delete=true&fileName="
+ path,
> File.class);
>                m.setHeader("newFileName", file.getName());
>                m.setBody(file);
>        }
> }
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Author of Camel in Action:
Open Source Integration:

View raw message