ule子-无法基于http.status路由消息 [英] Mule - unable to route message based on http.status

查看:128
本文介绍了ule子-无法基于http.status路由消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的Mule应用程序中创建一个选择路由器,该路由器将根据从HTTP出站端点接收到的响应代码来执行某些操作.我的配置如下-我遵循

I'm trying to create a choice router in my Mule application that will do something based on the response code received from an HTTP Outbound Endpoint. My config is as below - I followed the answers provided in this previous question:

<set-variable variableName="http.disable.status.code.exception.check" value="true" doc:name="Variable"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="hello" contentType="text/xml" method="POST" doc:name="HTTP"/>

<logger level="INFO" doc:name="Logger"/>

<choice doc:name="Choice">
    <when expression="#[message.inboundProperties['http.status']] == 200">
        <logger level="DEBUG" message="HTTP SUCCESS" doc:name="Debug"/>
    </when>
    <otherwise>
        <logger level="DEBUG" message="HTTP FAILURE" doc:name="Debug"/>                 
    </otherwise>
</choice>

但是,出现以下错误:

********************************************************************************
Message               : Execution of the expression "message.inboundProperties['http.status']] == 20" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: ReleasingInputStream
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: could not access: ]; in class: java.lang.String]
[Near : {... message.inboundProperties['htt ....}]
             ^
[Line: 1, Column: 1] (org.mvel2.PropertyAccessException)
  org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:690 (null)
2. Execution of the expression "message.inboundProperties['http.status']] == 20" failed. (org.mule.api.expression.ExpressionRuntimeException)
  org.mule.el.mvel.MVELExpressionLanguage:218 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "message.inboundProperties['http.status']] == 20" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: ReleasingInputStream (org.mule.api.MessagingException)
  org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:35 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
[Error: could not access: ]; in class: java.lang.String]
[Near : {... message.inboundProperties['htt ....}]
             ^
[Line: 1, Column: 1]
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:690)
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:472)
    at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:374)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

http.status的入站属性显然在范围之内,因为紧接在选择路由器之前的记录器的输出如下:

The http.status inbound property is clearly in the scope as the output from my logger immediately before the choice router is as below:

{
  id=dece5e82-db50-11e3-94e6-9552f33cb636
  payload=org.mule.transport.http.ReleasingInputStream
  correlationId=<not set>
  correlationGroup=-1
  correlationSeq=-1
  encoding=UTF-8
  exceptionPayload=<not set>

Message properties:
  INVOCATION scoped properties:
    http.disable.status.code.exception.check=true
    http.method=POST
  INBOUND scoped properties:
    Connection=true
    Content-Length=0
    Content-Type=text/plain
    Date=Wed, 14 May 2014 11:16:53 +0100
    Keep-Alive=true
    Server=Mule Core/3.4.0
    http.headers={Date=Wed, 14 May 2014 11:16:53 +0100, Content-Length=0, Keep-Alive=true, Connection=true, Content-Type=text/plain, Server=Mule Core/3.4.0}
    http.method=POST
    http.query.params={}
    http.query.string=
    http.request=http://localhost:8081/hello
    http.status=200
    http.version=HTTP/1.1
  OUTBOUND scoped properties:
    MULE_ENCODING=UTF-8
    MULE_SESSION=rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAEWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAD3NlY3VyaXR5Q29udGV4dHQAJ0xvcmcvbXVsZS9hcGkvc2VjdXJpdHkvU2VjdXJpdHlDb250ZXh0O3hwAXB0ACRkZWJiYzBjYi1kYjUwLTExZTMtOTRlNi05NTUyZjMzY2I2MzZwc3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW10AA9MamF2YS91dGlsL01hcDtMAAVtdXRleHQAEkxqYXZhL2xhbmcvT2JqZWN0O3hwc3IAJG9yZy5tdWxlLnV0aWwuQ2FzZUluc2Vuc2l0aXZlSGFzaE1hcJ3R2e9nRc4AAwAAeHB3DD9AAAAAAAAQAAAAAHhxAH4ACXh4
  SESSION scoped properties:
}

谁能确定我为什么遇到这个问题?预先感谢.

Can anyone identify why I'm having this issue? Thanks in advance.

推荐答案

您需要像这样将运算符放在the子表达式括号内:

You need to place your operator inside the mule expression brackets like so:

<when expression="#[message.inboundProperties['http.status'] == '200']">

这篇关于ule子-无法基于http.status路由消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆