【问题标题】:Mule Fundamentals Video Not Working for Me骡子基础视频不适合我
【发布时间】:2015-12-08 18:02:05
【问题描述】:

我使用 Macbook Pro 成功观看了 Mule Fundamentals 视频。我现在有 Windows 10,我正在做同样的事情,但在这种情况下,url/?language=French 不起作用,即查询参数language= 在记录器中显示西班牙语,并且在每种情况下消息流都通过Variable 组件为西班牙语默认值。

我已经检查并仔细检查了每个组件,但就像 message.inboundProperties 无法识别变量组件 #[message.inboundProperties['language']] 中设置的变量 Language

对于language=anythinglanguage=Spanish(默认)和默认有效负载是"Hola! Como esa"

这是xml

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
    <flow name="hellomuleFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <expression-filter expression="#[message.payload != '/favicon.ico']" doc:name="Expression" />
        <set-variable variableName="Language" value="#[message.inboundProperties['language']]" doc:name="Set Language Variable"/>
        <choice doc:name="Choice">
            <when expression="#[flowVars['language']=='Japanese']">
                <set-payload value="Konichiwa" doc:name="Respond in Japanese"/>
            </when>
            <when expression="#[flowVars['language']=='French']">
                <set-payload value="Bonjour" doc:name="Respond in French"/>
            </when>
            <otherwise>
                <set-variable variableName="language" value="Zulu" doc:name="Set Language"/>
                <set-payload value="Hola" doc:name="Respond in Spanish"/>
            </otherwise>
        </choice>
        <logger level="INFO" doc:name="Logger" message="The response &quot;#[message.payload]&quot; means Hello in #[flowVars['language']]"/>
    </flow>
</mule>

【问题讨论】:

  • 请分享您的整个 mule xml

标签: mule windows-10


【解决方案1】:

在设置变量值时进行更正。您正在尝试从标头中读取查询参数值。在设置变量值时按如下方式更改 MEL 表达式。在设置变量时将值更改为“#[message.inboundProperties.'http.query.params'.language]”

希望对你有所帮助!

【讨论】:

  • 谢谢苏达。我认为视频不正确或 inboundProperties 对于 Mac 来说已经足够了,但对于 WIndows 10 来说不够。当我添加 http.query.params'.language 时。那解决了它。 (Windows 10 不同?)
猜你喜欢
  • 2015-01-09
  • 1970-01-01
  • 1970-01-01
  • 2011-06-11
  • 1970-01-01
  • 2012-08-10
  • 2022-11-30
  • 1970-01-01
  • 2016-08-24
相关资源
最近更新 更多