Hi,

Here is my route.

public void configure() throws Exception {
            from("file://" + "c:/ufm/upload/" + "?delete=true").process(new
FileWaitProcessor()).process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    try {
                        FileModel fileModel = new FileModel();
                        logExchangeDetails(exchange);
                        // kailangan ko ipa write ito sa isang directory
                        logger.debug("Making A copy Of File In Processed
Directory.");
                        String processedDirectory =
sysParDao.findValueByCd("USR082");
                        String inputDirectory =
sysParDao.findValueByCd("USR081");
                        FileUtils.copyFile(new File(inputDirectory +
exchange.getIn().getHeader("org.apache.camel.file.name")), new
File(processedDirectory + exchange.getIn().getHeader("
org.apache.camel.file.name") + "-USED"));
                        DefaultMessage defaultMessage = new
DefaultMessage();
                        fileModel.setFileName(processedDirectory +
exchange.getIn().getHeader("org.apache.camel.file.name").toString() +
"-USED");
                        fileModel.setCoverName(exchange.getIn().getHeader("
org.apache.camel.file.name").toString());
                        defaultMessage.setBody(fileModel);
                        exchange.setOut(defaultMessage);
                        logger.debug("Successfuly Copied File.");
                    }
                    catch (Exception e) {
                        logger.error(e.getMessage());
                        e.printStackTrace();
                    }
                }

                private void logExchangeDetails(Exchange exchange) {
                    if(logger.isDebugEnabled()) {
                        logger.debug(exchange.getIn() + "");
                        logger.debug(exchange.getIn().getClass().getName());
                        logger.debug(exchange.getIn().getHeader("
org.apache.camel.file.name").toString());
                        logger.debug(exchange.getOut() + "");
                    }
                }

            }).to("direct:processingQueue");

Thanks In Advance

On Thu, Jul 16, 2009 at 1:02 PM, Claus Ibsen <[email protected]> wrote:

> Hi
>
> On Thu, Jul 16, 2009 at 6:29 AM, Carlo Camerino<[email protected]>
> wrote:
> > hi,
> >
> > i'm currently using file component in camel 2.0-M2. I'm finding out that
> > it's not working properly already unlike in camel 1.6 below.
> > is there any changes that I need to be implemented?
> >
> > The same route that I used for Camel 1.5 is not working for camel 2.0-M2
>
> Camel 2 have a rewritten file component so some options in 1.5 is eg
> not the same in 2.0.
>
>
> >
> > It's not getting properly from the directory that I set it to get from.
> > Do I need to change anything?
>
> First you need to post what the problem is. Writing that X does not
> work is not gonna help to much without
> being more specific.
>
> And also posting your route will help.
>
>
> >
> > Should I use file2 instead?
> >
>
> No there is no file2 as such. Its just the camel documentation being
> divided into the old and the new (file2).
>
>
>
> > Carlo
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Reply via email to