Hi Is there any files to pickup? And Camel will also not read the file if it cannot get a read lock on the file. Maybe the file is locked if you got it open in another program. So safe to drop in a file that you copy from somewhere else.
And some user had trouble with MS Office files being locked on Windows. You can also skip this locking by setting readLock=none And enable TRACE logging at org.apache.camel.component.file to see what it says. On Thu, Jul 16, 2009 at 9:32 AM, Carlo Camerino<[email protected]> wrote: > hmm there's no camel locks in there. > i deleted the directoyr, recreated it still doesn't work. > > here's my files > > package com.ccti.carnelian.ufm.routes; > > import java.io.File; > > import org.apache.camel.Exchange; > import org.apache.camel.Processor; > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.impl.DefaultMessage; > import org.apache.commons.io.FileUtils; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > import com.ccti.base.camel.model.FileModel; > import com.ccti.base.camel.processors.FileWaitProcessor; > import com.ccti.base.dao.syspar.SysParDao; > > public class FileRouteBuilder extends RouteBuilder { > private static final Logger logger = > LoggerFactory.getLogger(FileRouteBuilder.class); > private SysParDao sysParDao; > > �...@override > public void configure() throws Exception { > from("file:" + "c:/ufm/upload/" ).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"); > > } > > public SysParDao getSysParDao() { > return sysParDao; > } > > public void setSysParDao(SysParDao sysParDao) { > this.sysParDao = sysParDao; > } > } > > <?xml version = "1.0" encoding = "UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:amq="http://activemq.apache.org/schema/core" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:jms="http://www.springframework.org/schema/jms" > xmlns:tx="http://www.springframework.org/schema/tx" > xmlns:camel="http://camel.apache.org/schema/spring" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd > http://activemq.apache.org/schema/core > http://activemq.apache.org/schema/core/activemq-core.xsd > http://www.springframework.org/schema/jms > http://www.springframework.org/schema/jms/spring-jms-2.5.xsd > http://www.springframework.org/schema/tx > http://www.springframework.org/schema/tx/spring-tx-2.5.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > "> > > <camel:camelContext id="camelContext"> > <camel:package>com.ccti.carnelian.ufm.routes</camel:package> > <camel:jmxAgent id = "agent" disabled="true"/> > </camel:camelContext> > > I will be insvesitigating also. maybe it's just a simple mistake or > something > > On Thu, Jul 16, 2009 at 2:33 PM, Claus Ibsen <[email protected]> wrote: > >> On Thu, Jul 16, 2009 at 8:29 AM, Carlo Camerino<[email protected]> >> wrote: >> > it doesn't even enter the filewaitprocessor >> >> Could you take a look into the c:/ufm/upload folder. There could be >> some .camelLock file lurking that blocks it. >> eg you can try removing this folder all together and create a new empty >> one. >> >> >> >> > >> > On Thu, Jul 16, 2009 at 2:26 PM, Carlo Camerino <[email protected] >> >wrote: >> > >> >> 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 >> >>> >> >> >> >> >> > >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
