Oh! that's interesting. Thanks for the clue! On Fri, Jul 17, 2020 at 4:36 AM Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi > > Smells like you data is streaming and can only be read once. And so > when the data is < 20 then the content based router is evaluating 2 > times, and the 2nd time for < 20 the data cannot be re-read. > > See more at > https://camel.apache.org/manual/latest/stream-caching.html > > On Fri, Jul 10, 2020 at 8:30 PM Reji Mathews <contactr...@gmail.com> > wrote: > > > > I have a route like below > > > > <route customId="false" id="route360"> > > <from uri="jetty: > http://0.0.0.0:8081/branch?httpMethodRestrict=PUT > > "/> > > <onException id="onException172" useOriginalMessage="true"> > > <exception>java.lang.Exception</exception> > > <process id="process755"/> > > <log id="log656" loggingLevel="ERROR" > message="${exception}"/> > > <to id="to509" pattern="InOnly" > > uri="seda:exception_reporters?multipleConsumers=true"/> > > <process id="process756"/> > > </onException> > > <log id="log657" message="Received http payload : ${body}"/> > > <process id="process757"/> > > <process id="process758"/> > > <process id="process759"/> > > <choice id="choice15"> > > <when id="when37"> > > <jsonpath > > suppressExceptions="false">$.[?(@.age>20)]</jsonpath> > > <to id="to510" > > uri="direct:429552d4-3d87-3666-bd8d-a0db589044f3"/> > > </when> > > <when id="when38"> > > <jsonpath > > suppressExceptions="false">$.[?(@.age<20)]</jsonpath> > > <to id="to511" > > uri="direct:62eb1a9e-5720-3b67-8e70-8e00701a866e"/> > > </when> > > <otherwise id="otherwise7"> > > <to id="to512" > > uri="direct:cdf1dcb8-4228-3117-a220-cdc00647a5d5"/> > > </otherwise> > > </choice> > > </route> > > > > > > And I am using test payload as below > > > > { > > "age" : 12 > > } > > > > When the value of age is > 20, my filters work fine. But when it is less > > than 20, I get following error > > > > 14:23:13.305 [qtp1747371038-41] ERROR > > com.huawei.camel.core.route.RouteErrorHandler - Error has occurred: > > com.jayway.jsonpath.InvalidPathException: Filter: [?] can not be applied > to > > primitives. Current context is: > > 14:23:13.306 [qtp1747371038-41] ERROR route360 - > > org.apache.camel.ExpressionEvaluationException: > > com.jayway.jsonpath.InvalidPathException: Filter: [?] can not be applied > to > > primitives. Current context is: > > 14:23:13.310 [Camel (c01d8372-a93c-3b39-a961-57c58cf51a6b) thread #265 - > > seda://exception_reporters] INFO route361 - creating entry in error > table > > {"error_message":"com.jayway.jsonpath.InvalidPathException: Filter: [?] > can > > not be applied to primitives. Current context is: > > ","error_code":"APIC.8000"} > > > > Any idea? > > > > Regards > > Reji Mathews > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 >