Is the OGNL language fully supported in Camel or do we have restrictions ? http://www.opensymphony.com/ognl/html/LanguageGuide/index.html
Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer ***************************** blog : http://cmoulliard.blogspot.com On Thu, Jun 11, 2009 at 3:10 PM, Charles Moulliard <[email protected]>wrote: > I found my mistake > > Here is the good syntax : > > <camel:ognl>request.body.requestType = 'OINP'</camel:ognl> > > and not > > <camel:ognl>exchange.body.request.requestType = 'OINP'</camel:ognl> > > Charles Moulliard > Senior Enterprise Architect > Apache Camel Committer > > ***************************** > blog : http://cmoulliard.blogspot.com > > > On Thu, Jun 11, 2009 at 3:01 PM, Charles Moulliard > <[email protected]>wrote: > >> I have the following error : >> >> 14:58:29,000 | ERROR | tenerContainer-2 | EndpointMessageListener >> | rg.apache.camel.processor.Logger 207 | ognl.NoSuchPropertyException: >> org.apache.camel.component.jms.JmsExchange.body >> org.apache.camel.ExpressionEvaluationException: >> ognl.NoSuchPropertyException: >> org.apache.camel.component.jms.JmsExchange.body >> at >> org.apache.camel.language.ognl.OgnlExpression.evaluate(OgnlExpression.java:61) >> at >> org.apache.camel.impl.ExpressionSupport.matches(ExpressionSupport.java:32) >> at >> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:48) >> at >> org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52) >> at >> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53) >> at >> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82) >> at >> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:114) >> at >> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:61) >> 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.Pipeline.process(Pipeline.java:74) >> at >> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54) >> at >> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48) >> at >> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:81) >> at >> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543) >> at >> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482) >> at >> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451) >> at >> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323) >> at >> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261) >> at >> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982) >> at >> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:881) >> at java.lang.Thread.run(Thread.java:619) >> Caused by: ognl.NoSuchPropertyException: >> org.apache.camel.component.jms.JmsExchange.body >> at >> ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:151) >> at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2210) >> at ognl.ASTProperty.getValueBody(ASTProperty.java:114) >> at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) >> at ognl.SimpleNode.getValue(SimpleNode.java:258) >> at ognl.ASTChain.setValueBody(ASTChain.java:222) >> at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) >> at ognl.SimpleNode.setValue(SimpleNode.java:301) >> at ognl.ASTAssign.getValueBody(ASTAssign.java:53) >> at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) >> at ognl.SimpleNode.getValue(SimpleNode.java:258) >> at ognl.Ognl.getValue(Ognl.java:494) >> at ognl.Ognl.getValue(Ognl.java:458) >> at >> org.apache.camel.language.ognl.OgnlExpression.evaluate(OgnlExpression.java:58) >> ... 21 more >> >> Is it related to a bad syntax : >> >> <camel:route> >> <camel:from ref="queueRequestAcceptedEndpoint" /> >> <camel:convertBodyTo >> type="com.xpectis.x3s.platform.model.Request" /> >> <camel:choice> >> <camel:when> >> <camel:ognl>exchange.body.request.requestType = >> 'OINP'</camel:ognl> >> >> Regards, >> >> Charles Moulliard >> Senior Enterprise Architect >> Apache Camel Committer >> >> ***************************** >> blog : http://cmoulliard.blogspot.com >> >> >> On Thu, Jun 11, 2009 at 2:42 PM, Charles Moulliard >> <[email protected]>wrote: >> >>> I will test OGNL to have access to the setters fields of the object >>> placed in the body's exchange. >>> >>> Charles Moulliard >>> Senior Enterprise Architect >>> Apache Camel Committer >>> >>> ***************************** >>> blog : http://cmoulliard.blogspot.com >>> >>> >>> On Thu, Jun 11, 2009 at 1:53 PM, Claus Ibsen <[email protected]>wrote: >>> >>>> On Thu, Jun 11, 2009 at 1:49 PM, Charles Moulliard<[email protected]> >>>> wrote: >>>> > Hi, >>>> > >>>> > Can we have access to the content of the body using simple language ? >>>> > >>>> > eg. I have put a Request object in the body of my message and I would >>>> like >>>> > to test one of its property : author >>>> > >>>> > <camel:simple>${in.body.request.author} == 'camel'</camel:simple> >>>> No that will not happen. >>>> >>>> The simple is not a real language but was mainly added for Spring XML >>>> routing as you dont have >>>> a real language in the XML to use and that it could help with 75%+ of >>>> the use cases. >>>> For instance for some predicate tests in a content based router or the >>>> likes. >>>> >>>> But it cannot invoke methods based on a graph notation. Camel have >>>> plenty of other languages >>>> that can do this: OGNL, Mvel, EL, Groovy, and most of all them >>>> http://camel.apache.org/languages.html >>>> >>>> So pick one and you should be good to go. >>>> >>>> >>>> >>>> >>>> > >>>> > Regards, >>>> > >>>> > Charles Moulliard >>>> > Senior Enterprise Architect >>>> > Apache Camel Committer >>>> > >>>> > ***************************** >>>> > blog : http://cmoulliard.blogspot.com >>>> > >>>> >>>> >>>> >>>> -- >>>> Claus Ibsen >>>> Apache Camel Committer >>>> >>>> Open Source Integration: http://fusesource.com >>>> Blog: http://davsclaus.blogspot.com/ >>>> Twitter: http://twitter.com/davsclaus >>>> >>> >>> >> >
