camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas A." <>
Subject Using ConsumerTemplate to fetch files.
Date Tue, 14 Dec 2010 14:47:10 GMT


I'm trying to do a set up where I use a Spring Trigger to schedule the
trigging of a method that fetches a batch of files from ftp to local files
and then stops.

I don't think I'm quite grasping the way ConsumerTemplate works. When I do
as below the first run works, but the subsequent runs will fail, seemingly
when files run again are of the same name. I get cannot rename exceptions.
Am I experiencing competing consumers here or what? What is the correct way
of achieving what I want?

Would it make more sense to just use the  FTPSClient manually combined with
a Spring Trigger for this?

private ProducerTemplate producer;

private ConsumerTemplate consumer;

public void retrieveStatusFiles() throws Exception {		
	String ftpsUri =
	String fileUri = "file:{{}}";


	while(true) {
		Exchange ex = consumer.receive(ftpsUri, 5000);
		if(ex != null) {"Fetching file: " + ex.getIn().getHeader("CamelFileName"));
			producer.send(fileUri, ex);
		else if (ex == null) {
View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message