Hi,

I'm testing if is possible to use ConsumeTemplate to get a dynamic list of
files from a ftp endpoint. These files are related to the original message
as a reference attachments. I'm quite confuse because I'm testing this
scenario using existing local files to avoid first the use of a ftp service:

my bean processor looks like this:


public class myBeanProcessor{

@Autowired
ConsumerTemplate consumer;

@Autowired
ProducerTemplate producer;
               
public void enrich(Exchange exchange){
       Exchange ex = null;
       String[] filenames = { "file1.txt", "file2.txt", "file3.xt" };

       for (String filename : filenames) {
                try {
                        ex = consumer.receiveNoWait("file:/tmp?fileName=" + 
filename);

                        if (ex != null)
                                producer.send("file:/tmp?fileName=" + filename 
+ "_"
                                                        + 
exchange.getExchangeId() + ".txt", ex);

                } catch (Exception e) {
                        e.printStackTrace();
                } finally {
                        if (ex != null)
                                consumer.doneUoW(ex);
                }
        }
}

}


The result is that consumer always returns null, although files exists. I'm
sure there's something I did not understand because it's a very basic use
case. Can anyone help me on this? Thanks!!

      



--
View this message in context: 
http://camel.465427.n5.nabble.com/ConsumerTemplate-issue-tp5734177.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to