Python Expressions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Python Expressions

Aaron Mulder
So I'm also having trouble trying out Python expressions.  If I do this:

        <route>
            <from uri="activemq:topic:ScriptTest" />
            <choice>
                <when>
                    <python>request.headers['console'] == 'Wii'</python>
                    <to uri="bean:test?methodName=handleWii" />
                </when>

Then I get this:

java.lang.NullPointerException
        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:457)
        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:83)
        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:49)
        at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:47)
        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143)
        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
        at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
...

It almost seems like the Python expression is returning null instead
of the expected boolean?  I tried putting a "return" in there to no
avail.  If I mess up the syntax it says so (for example,
request.headers.console does not work in Python), so it's doing
*something* -- I just don't see why the expression isn't working.

Any ideas?


FWIW, so far I'm OK with EL, OGNL, Groovy, and JXPath.  No dice with
Ruby or Python.

Thanks,
       Aaron
Reply | Threaded
Open this post in threaded view
|

Re: Python Expressions

jstrachan
What happens if you use trunk?

2008/7/1 Aaron Mulder <[hidden email]>:

> So I'm also having trouble trying out Python expressions.  If I do this:
>
>        <route>
>            <from uri="activemq:topic:ScriptTest" />
>            <choice>
>                <when>
>                    <python>request.headers['console'] == 'Wii'</python>
>                    <to uri="bean:test?methodName=handleWii" />
>                </when>
>
> Then I get this:
>
> java.lang.NullPointerException
>        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:457)
>        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:83)
>        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:49)
>        at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:47)
>        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143)
>        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
>        at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
> ...
>
> It almost seems like the Python expression is returning null instead
> of the expected boolean?  I tried putting a "return" in there to no
> avail.  If I mess up the syntax it says so (for example,
> request.headers.console does not work in Python), so it's doing
> *something* -- I just don't see why the expression isn't working.
>
> Any ideas?
>
>
> FWIW, so far I'm OK with EL, OGNL, Groovy, and JXPath.  No dice with
> Ruby or Python.
>
> Thanks,
>       Aaron
>



--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com