camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bocamel <johnz...@gmail.com>
Subject RE: Cannot access CamelLoopIndex in route using spel
Date Mon, 15 Jul 2013 02:35:22 GMT
Thanks Willem.  Your suggestion worked beautifully.

 

From: Willem.Jiang [via Camel] [mailto:ml-node+s465427n5735642h80@n5.nabble.com] 
Sent: Sunday, July 14, 2013 10:19 PM
To: bocamel
Subject: Re: Cannot access CamelLoopIndex in route using spel

 

Hi, 

If you want to access the CamelLoopIndex, you should use properties['CamelLoopIndex'] instead
of property(CamelLoopIndex). 


--   
Willem Jiang 

Red Hat, Inc. 
FuseSource is now part of Red Hat 
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) 
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) 
Twitter: willemjiang   
Weibo: 姜宁willem 





On Monday, July 15, 2013 at 9:24 AM, bocamel wrote: 


> I need to access CamelLoopIndex within a route. According to 
> http://camel.apache.org/loop.html, CamelLoopIndex is a property in the 
> Exchange while in the loop. I tried this simple test route: 
>   
> <camel:route> 
> <camel:from uri="file:src/data?noop=true"/> 
> <setBody><constant>Count </constant></setBody>   
> <camel:loop> 
> <constant>5</constant> 
> <setBody><camel:spel>#{body + ':' + 
> property(CamelLoopIndex)}</camel:spel></setBody> 
> <camel:to uri="file:target/messages/out" />   
> </camel:loop> 
> </camel:route> 
>   
> But I received the error below. Any help will be greatly appreciated. 
>   
>   
> org.apache.camel.ExpressionEvaluationException: 
> org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 
> 22): Field or property 'CamelLoopIndex' cannot be found on object of type 
> 'org.apache.camel.language.spel.RootObject' 
> at 
> org.apache.camel.language.spel.SpelExpression.evaluate(SpelExpression.java:64) 
> at 
> org.apache.camel.processor.SetBodyProcessor.process(SetBodyProcessor.java:38) 
> at 
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.processor.interceptor.BacklogTracerInterceptor.process(BacklogTracerInterceptor.java:84)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:390)

> at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:273)

> at 
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:335)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:117) 
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) 
> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at org.apache.camel.processor.LoopProcessor.process(LoopProcessor.java:103) 
> at org.apache.camel.processor.LoopProcessor.process(LoopProcessor.java:74) 
> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.processor.interceptor.BacklogTracerInterceptor.process(BacklogTracerInterceptor.java:84)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:390)

> at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:273)

> at 
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:335)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:117) 
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) 
> at 
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)

> at 
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)

> at 
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) 
> at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

> at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

> at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)

> at 
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:350)

> at 
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:197)

> at 
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:163)

> at 
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:141) 
> at 
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91) 
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
> at 
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) 
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) 
> at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)

> at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)

> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
> at java.lang.Thread.run(Thread.java:722) 
> Caused by: org.springframework.expression.spel.SpelEvaluationException: 
> EL1008E:(pos 22): Field or property 'CamelLoopIndex' cannot be found on 
> object of type 'org.apache.camel.language.spel.RootObject' 
> at 
> org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:208)

> at 
> org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:72)

> at 
> org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:65)

> at 
> org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:70) 
> at 
> org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93) 
> at 
> org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:88)

> at 
> org.apache.camel.language.spel.SpelExpression.evaluate(SpelExpression.java:60) 
> ... 71 more 
>   
>   
>   
>   
> -- 
> View this message in context: http://camel.465427.n5.nabble.com/Cannot-access-CamelLoopIndex-in-route-using-spel-tp5735638.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com). 
>   







  _____  

If you reply to this email, your message will be added to the discussion below:

http://camel.465427.n5.nabble.com/Cannot-access-CamelLoopIndex-in-route-using-spel-tp5735638p5735642.html


To unsubscribe from Cannot access CamelLoopIndex in route using spel, click here <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5735638&code=am9obnp5aW5AZ21haWwuY29tfDU3MzU2Mzh8Mjk3Mjc3MTQ4>
.
 <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
NAML 





--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-access-CamelLoopIndex-in-route-using-spel-tp5735638p5735643.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message