Question

In mule 3.3.0 CE, I add these lines in my configuration XML file:

<flow name="muleService" doc:name="muleService">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<choice doc:name="Choice">
    <when expression="payload.get('type') == 'normal'" evaluator="groovy">
        <processor-chain>
            <component class="com.mule.routing.routingClass1" doc:name="Java"/>
        </processor-chain>
    </when>
    <when expression="payload.get('type') == 'priority'" evaluator="groovy">
        <processor-chain>
            <component class="com.mule.routing.routingClass2" doc:name="Java"/>
        </processor-chain>
    </when>
    <otherwise>
        <processor-chain>
            <component class="com.mule.routing.routingClass1" doc:name="DefaultQueue"/>
        </processor-chain>
    </otherwise>        
</choice>

When I run my project, and enter thisurl : localhost:8081/priority or localhost:8081/normal I have this error:

    javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: java.lang.String.get() is applicable for argument types: (java.lang.String) values: [type]
Possible solutions: getAt(java.lang.String), grep(), next(), next(), getAt(groovy.lang.Range), getAt(groovy.lang.Range) (org.mule.api.MuleRuntimeException). Message payload is of type: String

How can I solve this issue?

Was it helpful?

Solution

The problem is with your expression, try the following one:

expression="payload.equalsIgnoreCase('normal')"

Also as evaluator you are currently using Groovy, but ever since mule 3.3 MEL usage is highly encouraged.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top