2013-03-10 98 views
0

在騾子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:本地主機:8081 /優先級或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 

我該如何解決這個問題?

回答

2

問題是與你的表達,請嘗試以下之一:

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

另外,作爲評估你目前正在使用Groovy,但自從騾子3.3 MEL使用是非常鼓勵。