On Thu, Jul 16, 2009 at 10:48 AM, Carlo Camerino<[email protected]> wrote:
> is this different from route?
> my route is something like this
>
> from("file").to("direct").threads(5).process(new Processor()) {
> })
>
> before in camel 1.x, after leaving file, the file is already deleted.
> for now, will it only be deleted after processor?

Yeah Camel uses onCompletion strategies to do the commit/rollback work
when the exchange has completed its route.
http://camel.apache.org/oncompletion.html

So in this case the file component will do the delete of the file
after the exchange is done being routed.

If you *always* want to delete the file then you can either one:
- use your own processStrategy on the file component that deletes the
file no matter what
- use your own onCompletion to delete the file no matter what
- use onException to handle the exception so Camel do not think there
is an exception
   for instance: onException(Exception.class).handled(true).stop()

// ignore exception as we just handle them and stop continue routing.
Then the file component thinks we are finsihed
// and it will delete the file
onException(Exception.class).handled(true).stop();

from(file).threads(5).process(new Processor());



>
> thanks
> carlo
>
> On Thu, Jul 16, 2009 at 4:35 PM, Claus Ibsen <[email protected]> wrote:
>
>> Hi
>>
>> Yes Camel 2.0 is not 1.x. So some things are different/better in 2.0 than
>> 1.x.
>> It was in fact wrong in 1.x where Camel just deletes/moves the file
>> regardless what happens.
>>
>> If you want the file deleted no matter what then move it to a seda
>> queue and grab it from there in the route you continue
>>
>> from(file) -> seda:foo
>> from(seda:foo) -> do whatever you want
>>
>> You can also provide your own process startegy to the camel file
>> component where you handle the commit/rollback yourself and delete the
>> file no matter what.
>>
>>
>>
>> On Thu, Jul 16, 2009 at 10:24 AM, Carlo Camerino<[email protected]>
>> wrote:
>> > what happens is taht the exceptions just ocntinue on appearing everytime.
>> > DEBUG - GenericFileOnCompletion    - Done processing file:
>> > GenericFile[c:\ufm\upload\UFM.png] using exchange:
>> > Exchange[GenericFileMessage with body:
>> > com.ccti.base.camel.model.filemo...@17d7379]
>> > ERROR - GenericFileOnCompletion    -
>> > java.lang.NullPointerException
>> >    at
>> >
>> com.ccti.carnelian.service.batchuploadhdr.BatchUploadHdrServiceImpl.updateRolledBackFile(BatchUploadHdrServiceImpl.java:103)
>> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >    at
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >    at
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >    at java.lang.reflect.Method.invoke(Method.java:585)
>> >    at
>> >
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>> >    at
>> >
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >    at
>> >
>> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >    at
>> >
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> >    at $Proxy25.updateRolledBackFile(Unknown Source)
>> >    at
>> >
>> com.ccti.carnelian.ufm.processor.PayoutFileProcessor.process(PayoutFileProcessor.java:58)
>> >    at
>> >
>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>> >    at
>> >
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
>> >    at
>> >
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
>> >    at
>> >
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>> >    at
>> >
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>> >    at
>> >
>> org.apache.camel.processor.ThreadsProcessor$1.call(ThreadsProcessor.java:94)
>> >    at
>> >
>> org.apache.camel.processor.ThreadsProcessor$1.call(ThreadsProcessor.java:92)
>> >    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>> >    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>> >    at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:65)
>> >    at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:172)
>> >    at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
>> >    at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
>> >    at java.lang.Thread.run(Thread.java:595)
>> > WARN  - GenericFileOnCompletion    - Rolling back remote file strategy:
>> >
>> org.apache.camel.component.file.strategy.genericfiledeleteprocessstrat...@1b5438dfor
>> > file: GenericFile[c:\ufm\upload\UFM.png]
>> > DEBUG - FileConsumer               - Total 1 files to consume
>> > DEBUG - FileConsumer               - About to process file:
>> > GenericFile[c:\ufm\upload\UFM.png] using exchange:
>> > Exchange[GenericFileMessage with file:
>> GenericFile[c:\ufm\upload\UFM.png]]
>> > Hibernate: select this_.ID as ID8_0_, this_.VERSION as VERSION8_0_,
>> this_.CD
>> > as CD8_0_, this_.DSCP as DSCP8_0_, this_.VALUE as VALUE8_0_, this_.TYPE
>> as
>> > TYPE8_0_, this_.IS_SECURITY as IS7_8_0_, this_.IS_EDITABLE as IS8_8_0_,
>> > this_.SEQ_NO as SEQ9_8_0_ from TBL_SYSPAR this_ where this_.CD=?
>> > Hibernate: select this_.ID as ID8_0_, this_.VERSION as VERSION8_0_,
>> this_.CD
>> > as CD8_0_, this_.DSCP as DSCP8_0_, this_.VALUE as VALUE8_0_, this_.TYPE
>> as
>> > TYPE8_0_, this_.IS_SECURITY as IS7_8_0_, this_.IS_EDITABLE as IS8_8_0_,
>> > this_.SEQ_NO as SEQ9_8_0_ from TBL_SYSPAR this_ where this_.CD=?
>> > Hibernate: select this_.CD_TYPE as CD1_7_0_, this_.VERSION as
>> VERSION7_0_,
>> > this_.CD_DSCP as CD3_7_0_, this_.IS_RESET as IS4_7_0_, this_.IS_CHK_DIGIT
>> as
>> > IS5_7_0_, this_.IS_W_CODE as IS6_7_0_, this_.IS_W_DATE as IS7_7_0_,
>> > this_.SEQ_LEN as SEQ8_7_0_, this_.IS_RESET_DAILY as IS9_7_0_ from
>> > TBL_SEQ_NO_TYPE this_ where this_.CD_TYPE=?
>> > Hibernate: select count(*) as y0_ from TBL_SEQ_NO_CD this_ where
>> this_.CD=?
>> > and this_.CD_TYPE=?
>> > Hibernate: select this_.ID as ID6_0_, this_.VERSION as VERSION6_0_,
>> this_.CD
>> > as CD6_0_, this_.CD_TYPE as CD4_6_0_, this_.SEQ_NO as SEQ5_6_0_, this_.DT
>> as
>> > DT6_0_ from TBL_SEQ_NO_CD this_ where this_.CD=? and this_.CD_TYPE=?
>> > Hibernate: update TBL_SEQ_NO_CD set VERSION=?, CD=?, CD_TYPE=?, SEQ_NO=?,
>> > DT=? where ID=? and VERSION=?
>> > Hibernate: select this_.ID as ID20_0_, this_.VERSION as VERSION20_0_,
>> > this_.REF_NO as REF3_20_0_, this_.UPLOAD_DT as UPLOAD4_20_0_,
>> this_.USER_CD
>> > as USER5_20_0_, this_.COMMUNITY_CD as COMMUNITY6_20_0_, this_.FILENAME as
>> > FILENAME20_0_, this_.NO_RECORDS as NO8_20_0_, this_.STATUS as
>> STATUS20_0_,
>> > this_.REASON as REASON20_0_, this_.PROC_DTTIME as PROC11_20_0_,
>> > this_.CENTER_CD as CENTER12_20_0_, this_.COVER_AMT as COVER13_20_0_,
>> > this_.COVER_NO as COVER14_20_0_, this_.XMIT_DT as XMIT15_20_0_,
>> > this_.OVERRIDE_USER as OVERRIDE16_20_0_, this_.NO_RECORDS_PROC as
>> > NO17_20_0_, this_.CNT_TOTAL as CNT18_20_0_, this_.TOTAL_AMT as
>> > TOTAL19_20_0_, this_.HASH_TOTAL as HASH20_20_0_ from TBL_BATCH_UPLOAD_HDR
>> > this_ where this_.REF_NO=?
>> > DEBUG - GenericFileOnCompletion    - Done processing file:
>> > GenericFile[c:\ufm\upload\UFM.png] using exchange:
>> > Exchange[GenericFileMessage with body:
>> > com.ccti.base.camel.model.filemo...@86a602]
>> > ERROR - GenericFileOnCompletion    -
>> > java.lang.NullPointerException
>> >    at
>> >
>> com.ccti.carnelian.service.batchuploadhdr.BatchUploadHdrServiceImpl.updateRolledBackFile(BatchUploadHdrServiceImpl.java:103)
>> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >    at
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >    at
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >    at java.lang.reflect.Method.invoke(Method.java:585)
>> >    at
>> >
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>> >    at
>> >
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >    at
>> >
>> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >    at
>> >
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> >    at $Proxy25.updateRolledBackFile(Unknown Source)
>> >    at
>> >
>> com.ccti.carnelian.ufm.processor.PayoutFileProcessor.process(PayoutFileProcessor.java:58)
>> >    at
>> >
>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>> >    at
>> >
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
>> >    at
>> >
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
>> >    at
>> >
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>> >    at
>> >
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>> >    at
>> >
>> org.apache.camel.processor.ThreadsProcessor$1.call(ThreadsProcessor.java:94)
>> >    at
>> >
>> org.apache.camel.processor.ThreadsProcessor$1.call(ThreadsProcessor.java:92)
>> >    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>> >    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>> >    at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:65)
>> >    at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:172)
>> >    at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
>> >    at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
>> >    at java.lang.Thread.run(Thread.java:595)
>> > WARN  - GenericFileOnCompletion    - Rolling back remote file strategy:
>> >
>> org.apache.camel.component.file.strategy.genericfiledeleteprocessstrat...@1b5438dfor
>> > file: GenericFile[c:\ufm\upload\UFM.png]
>> > DEBUG - FileConsumer               - Total 1 files to consume
>> > DEBUG - FileConsumer               - About to process file:
>> > GenericFile[c:\ufm\upload\UFM.png] using exchange:
>> > Exchange[GenericFileMessage with file:
>> GenericFile[c:\ufm\upload\UFM.png]]
>> > Hibernate: select this_.ID as ID8_0_, this_.VERSION as VERSION8_0_,
>> this_.CD
>> > as CD8_0_, this_.DSCP as DSCP8_0_, this_.VALUE as VALUE8_0_, this_.TYPE
>> as
>> > TYPE8_0_, this_.IS_SECURITY as IS7_8_0_, this_.IS_EDITABLE as IS8_8_0_,
>> > this_.SEQ_NO as SEQ9_8_0_ from TBL_SYSPAR this_ where this_.CD=?
>> > Hibernate: select this_.ID as ID8_0_, this_.VERSION as VERSION8_0_,
>> this_.CD
>> > as CD8_0_, this_.DSCP as DSCP8_0_, this_.VALUE as VALUE8_0_, this_.TYPE
>> as
>> > TYPE8_0_, this_.IS_SECURITY as IS7_8_0_, this_.IS_EDITABLE as IS8_8_0_,
>> > this_.SEQ_NO as SEQ9_8_0_ from TBL_SYSPAR this_ where this_.CD=?
>> > Hibernate: select this_.CD_TYPE as CD1_7_0_, this_.VERSION as
>> VERSION7_0_,
>> > this_.CD_DSCP as CD3_7_0_, this_.IS_RESET as IS4_7_0_, this_.IS_CHK_DIGIT
>> as
>> > IS5_7_0_, this_.IS_W_CODE as IS6_7_0_, this_.IS_W_DATE as IS7_7_0_,
>> > this_.SEQ_LEN as SEQ8_7_0_, this_.IS_RESET_DAILY as IS9_7_0_ from
>> > TBL_SEQ_NO_TYPE this_ where this_.CD_TYPE=?
>> > Hibernate: select count(*) as y0_ from TBL_SEQ_NO_CD this_ where
>> this_.CD=?
>> > and this_.CD_TYPE=?
>> > Hibernate: select this_.ID as ID6_0_, this_.VERSION as VERSION6_0_,
>> this_.CD
>> > as CD6_0_, this_.CD_TYPE as CD4_6_0_, this_.SEQ_NO as SEQ5_6_0_, this_.DT
>> as
>> > DT6_0_ from TBL_SEQ_NO_CD this_ where this_.CD=? and this_.CD_TYPE=?
>> > Hibernate: update TBL_SEQ_NO_CD set VERSION=?, CD=?, CD_TYPE=?, SEQ_NO=?,
>> > DT=? where ID=? and VERSION=?
>> > Hibernate: select this_.ID as ID20_0_, this_.VERSION as VERSION20_0_,
>> > this_.REF_NO as REF3_20_0_, this_.UPLOAD_DT as UPLOAD4_20_0_,
>> this_.USER_CD
>> > as USER5_20_0_, this_.COMMUNITY_CD as COMMUNITY6_20_0_, this_.FILENAME as
>> > FILENAME20_0_, this_.NO_RECORDS as NO8_20_0_, this_.STATUS as
>> STATUS20_0_,
>> > this_.REASON as REASON20_0_, this_.PROC_DTTIME as PROC11_20_0_,
>> > this_.CENTER_CD as CENTER12_20_0_, this_.COVER_AMT as COVER13_20_0_,
>> > this_.COVER_NO as COVER14_20_0_, this_.XMIT_DT as XMIT15_20_0_,
>> > this_.OVERRIDE_USER as OVERRIDE16_20_0_, this_.NO_RECORDS_PROC as
>> > NO17_20_0_, this_.CNT_TOTAL as CNT18_20_0_, this_.TOTAL_AMT as
>> > TOTAL19_20_0_, this_.HASH_TOTAL as HASH20_20_0_ from TBL_BATCH_UPLOAD_HDR
>> > this_ where this_.REF_NO=?
>> > DEBUG - GenericFileOnCompletion    - Done processing file:
>> > GenericFile[c:\ufm\upload\UFM.png] using exchange:
>> > Exchange[GenericFileMessage with body:
>> > com.ccti.base.camel.model.filemo...@1c59085]
>> > ERROR - GenericFileOnCompletion    -
>> > java.lang.NullPointerException
>> >    at
>> >
>> com.ccti.carnelian.service.batchuploadhdr.BatchUploadHdrServiceImpl.updateRolledBackFile(BatchUploadHdrServiceImpl.java:103)
>> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >    at
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >    at
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >    at java.lang.reflect.Method.invoke(Method.java:585)
>> >    at
>> >
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>> >    at
>> >
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >    at
>> >
>> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>> >    at
>> >
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >    at
>> >
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> >    at $Proxy25.updateRolledBackFile(Unknown Source)
>> >    at
>> >
>> com.ccti.carnelian.ufm.processor.PayoutFileProcessor.process(PayoutFileProcessor.java:58)
>> >    at
>> >
>> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)
>> >    at
>> >
>> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:52)
>> >    at
>> >
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:147)
>> >    at
>> >
>> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
>> >    at
>> >
>> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>> >    at
>> >
>> org.apache.camel.processor.ThreadsProcessor$1.call(ThreadsProcessor.java:94)
>> >    at
>> >
>> org.apache.camel.processor.ThreadsProcessor$1.call(ThreadsProcessor.java:92)
>> >    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
>> >    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
>> >    at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:65)
>> >    at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:172)
>> >    at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
>> >    at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
>> >    at java.lang.Thread.run(Thread.java:595)
>> > WARN  - GenericFileOnCompletion    - Rolling back remote file strategy:
>> >
>> org.apache.camel.component.file.strategy.genericfiledeleteprocessstrat...@1b5438dfor
>> > file: GenericFile[c:\ufm\upload\UFM.png]
>> > DEBUG - FileConsumer               - Total 1 files to consume
>> > DEBUG - FileConsumer               - About to process file:
>> > GenericFile[c:\ufm\upload\UFM.png] using exchange: Excha
>> >
>> > [...]
>> >
>> >
>> > behavior wasn't like this before.
>> >
>> > On Thu, Jul 16, 2009 at 4:23 PM, Carlo Camerino <[email protected]
>> >wrote:
>> >
>> >> hmm, actually i'm already in a different route in where I process the
>> file
>> >> already.
>> >> what's happening is the file gets processed again. Before in previous
>> >> versions, I think the file is deleted right after the
>> >>
>> >> from("file:")
>> >>
>> >> declaration.
>> >>
>> >> is this a new behavior in camel 2?
>> >> i think this wasn't present before in the previous camel versions.
>> >>
>> >>
>> >> On Thu, Jul 16, 2009 at 4:20 PM, Claus Ibsen <[email protected]
>> >wrote:
>> >>
>> >>> On Thu, Jul 16, 2009 at 10:16 AM, Carlo Camerino<
>> [email protected]>
>> >>> wrote:
>> >>> > hi,
>> >>> >
>> >>> > i've also noticed this behavior change, when I encounter an error for
>> an
>> >>> > example ina  certgain part of the code and encounter an exception.
>> The
>> >>> file
>> >>> > still remains in the directory and the file will bde processed all
>> over
>> >>> > again.
>> >>> >
>> >>> > Does delete=true still work in this scenario?
>> >>> No Camel will only delete the file if it was processed OK.
>> >>>
>> >>> You do not want to "loose messages". If there is an error or the likes
>> >>> use Camel error handling to handle
>> >>> it in case you can and then the file can be deleted.
>> >>> http://camel.apache.org/error-handling-in-camel.html
>> >>>
>> >>>
>> >>>
>> >>> >
>> >>> > Thanks
>> >>> >
>> >>> > On Thu, Jul 16, 2009 at 3:59 PM, Carlo Camerino <
>> [email protected]
>> >>> >wrote:
>> >>> >
>> >>> >> i removed the annotations but still didn't work.
>> >>> >>
>> >>> >> it finally worked when I added a routebuilderref.
>> >>> >>
>> >>> >> thanks for the help!!!
>> >>> >>
>> >>> >>
>> >>> >> On Thu, Jul 16, 2009 at 3:52 PM, Claus Ibsen <[email protected]
>> >>> >wrote:
>> >>> >>
>> >>> >>> Hi
>> >>> >>>
>> >>> >>> If you are using some annotations in your route classes then Spring
>> >>> >>> might not be able to IoC them properly and just ignore these files.
>> >>> >>> Has been improved in later code, eg 2.0m3 or SNAPSHOT.
>> >>> >>>
>> >>> >>> So try not having annotations in them.
>> >>> >>>
>> >>> >>> And you can also use a <routeBuilderRef> to refer to the route
>> class
>> >>> >>> directly without the classpath scanner.
>> >>> >>>
>> >>> >>>
>> >>> >>> On Thu, Jul 16, 2009 at 9:49 AM, Carlo Camerino<
>> >>> [email protected]>
>> >>> >>> wrote:
>> >>> >>> > are my routes being picked up properly?
>> >>> >>> >
>> >>> >>> > here is the output of debug log in camel.
>> >>> >>> >
>> >>> >>> > INFO  - DefaultCamelContext        - JMX enabled. Using
>> >>> >>> > InstrumentationLifecycleStrategy.
>> >>> >>> > INFO  - CamelContextFactoryBean    - JMXAgent disabled
>> >>> >>> > DEBUG - CamelContextFactoryBean    - Found JAXB created routes:
>> []
>> >>> >>> > DEBUG - ltPackageScanClassResolver - Searching for
>> implementations
>> >>> of
>> >>> >>> > org.apache.camel.Routes in packages:
>> [com.ccti.carnelian.ufm.routes]
>> >>> >>> > DEBUG - ltPackageScanClassResolver - Loading from directory:
>> >>> >>> >
>> >>> >>>
>> >>>
>> C:\PROJECTS\CHINABANK\cbc-carnelian\carnelian-parent\carnelian-ufm\target\classes\com\ccti\carnelian\ufm\routes
>> >>> >>> > DEBUG - ltPackageScanClassResolver - Found: [class
>> >>> >>> > com.ccti.carnelian.ufm.routes.FileRouteBuilder, class
>> >>> >>> > com.ccti.carnelian.ufm.routes.QueueRouteBuilder]
>> >>> >>> > Hibernate: update TBL_USER set IS_LOGIN=0
>> >>> >>> > DEBUG - SpringCamelContext         - Publishing spring-event:
>> >>> >>> >
>> >>> >>>
>> >>>
>> org.springframework.context.event.contextrefreshedevent[source=org.springframework.web.context.support.xmlwebapplicationcont...@1b17d49
>> >>> >>> :
>> >>> >>> > display name [Root WebApplicationContext]; startup date [Thu Jul
>> 16
>> >>> >>> 15:46:19
>> >>> >>> > SGT 2009]; root of context hierarchy]
>> >>> >>> > DEBUG - SpringCamelContext         - Starting the CamelContext
>> now
>> >>> that
>> >>> >>> the
>> >>> >>> > ApplicationContext has started
>> >>> >>> > INFO  - DefaultCamelContext        - Apache Camel 2.0-M2
>> >>> >>> > (CamelContext:camelContext) is starting
>> >>> >>> > DEBUG - DefaultProducerServicePool - Starting service pool:
>> >>> >>> > org.apache.camel.impl.defaultproducerservicep...@14c0761
>> >>> >>> > DEBUG - DefaultCamelContext        - StreamCaching is enabled
>> >>> >>> > DEBUG - DefaultComponent           - Creating endpoint
>> >>> >>> > uri=[spring-event:default], path=[default], parameters=[{}]
>> >>> >>> > DEBUG - DefaultCamelContext        - spring-event:default
>> converted
>> >>> to
>> >>> >>> > endpoint: Endpoint[spring-event:default] by component:
>> >>> >>> > org.apache.camel.component.event.eventcompon...@1ca32f7
>> >>> >>> > DEBUG - DefaultProducerServicePool - Stopping service pool:
>> >>> >>> > org.apache.camel.impl.defaultproducerservicep...@14c0761
>> >>> >>> > INFO  - DefaultCamelContext        - Apache Camel 2.0-M2
>> >>> >>> > (CamelContext:camelContext) started
>> >>> >>> >
>> >>> >>> > i'll paste trace log also
>> >>> >>> >
>> >>> >>> > On Thu, Jul 16, 2009 at 3:47 PM, Claus Ibsen <
>> [email protected]
>> >>> >
>> >>> >>> wrote:
>> >>> >>> >
>> >>> >>> >> 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
>> >>> >>> >>
>> >>> >>> >
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>> >>> --
>> >>> >>> 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
>>
>



-- 
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