在mule 3.3.0 CE中,我在配置XML文件中添加了这些行:
<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>
当我运行我的项目时,输入thisurl:localhost:8081 / priority或localhost:8081 / normal我有这个错误:
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
我该如何解决这个问题?
答案 0 :(得分:2)
问题在于您的表达,请尝试以下方法:
expression="payload.equalsIgnoreCase('normal')"
同样作为评估者,您目前正在使用Groovy,但自从强烈鼓励使用mule 3.3 MEL以来。