Mule - 如何在http:listener中使用set-session-variable?

时间:2015-05-24 14:44:43

标签: mule session-variables mule-studio httplistener mule-component

我有一个xy[1]=2由Mule中的两个composite-source组成;

我希望在收到来自这些侦听器的请求后,根据每个侦听器设置变量;

但在mule 3.6.0中部署时出现此错误:

http:listener

我该怎么办?

这是我的代码:

org.mule.module.launcher.DeploymentInitException: SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'set-session-variable'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/http":response-builder, "http://www.mulesoft.org/schema/mule/http":error-response-builder}' is expected.

P.S。我用<composite-source doc:name="Composite Source"> <http:listener config-ref="HTTP_Listener_Configuration_Source1" path="/" doc:name="HTTP"> <set-session-variable doc:name="Session Variable" value="#[x]" variableName="x" /> </http:listener> <http:listener config-ref="HTTP_Listener_Configuration_Source2" path="/" doc:name="HTTP"> <set-session-variable doc:name="Session Variable" value="#[y]" variableName="x" /> </http:listener> </composite-source>

完成了

1 个答案:

答案 0 :(得分:2)

set-session-variable放在那里是违法的:Mule架构不允许它。

原因是http:listener不是常规endpoint,就像http:inbound-endpoint一样,因此不支持这种嵌套,就像所有其他端点一样。

这是不幸的,希望最终得到解决的事情。与此同时,您需要找到另一种方法来区分这两个听众之间的请求。

为此,我建议您检查他们创建的所有入站消息属性,寻找差异化因素。我希望MULE_属性可以在这里使用,但您必须使用您正在使用的特定HTTP_Listener配置检查您的特定上下文。

相关问题