【发布时间】:2013-12-18 06:53:14
【问题描述】:
我有一个 mule 流,它是一个 SOAP Web 服务客户端 (Mule Flow - A)。此客户端调用将每 30 分钟执行一次,以从第 3 方检索唯一的会话密钥。我有其他 mule 流(作为单独的 mule 应用程序运行)需要在其流中引用此会话变量。我的问题是 - 有没有办法将 Mule Flow A 检索到的会话密钥保存在 mule 服务器内存中,以便其他 mule 应用程序可以在运行时访问它? 可以将数据保存在文件或数据库中的某处并检索它,但我想在得出解决方案之前检查是否可以这样做。
谢谢!
更新了共享对象存储的示例 Mule 流程:
流程一:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore" 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" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/objectstore http://www.mulesoft.org/schema/mule/objectstore/1.0/mule-objectstore.xsd">
<spring:beans>
<spring:bean id="myListableObjectStore" class="org.mule.util.store.SimpleMemoryObjectStore"/>
</spring:beans>
<objectstore:config name="ObjectStore" objectStore-ref="myListableObjectStore" doc:name="ObjectStore"/>
<flow name="objectstoreFlow1" doc:name="objectstoreFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8083" doc:name="HTTP"/>
<message-filter doc:name="Filter favicon">
<not-filter>
<wildcard-filter pattern="/favicon.ico" caseSensitive="true"/>
</not-filter>
</message-filter>
<logger message="#[message.InboundProperties.key]" level="INFO" doc:name="Logger"/>
<objectstore:store config-ref="ObjectStore" key="#[message.inboundProperties.key]" value-ref="#[message.inboundProperties.value]" doc:name="ObjectStore"/>
</flow>
</mule>
Mule Flow 2 - 检索值
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore" 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" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/objectstore http://www.mulesoft.org/schema/mule/objectstore/1.0/mule-objectstore.xsd">
<spring:beans>
<spring:bean id="myListableObjectStore" class="org.mule.util.store.SimpleMemoryObjectStore"/>
</spring:beans>
<objectstore:config name="ObjectStore" objectStore-ref="myListableObjectStore" doc:name="ObjectStore"/>
<flow name="MemoryTest2Flow1" doc:name="MemoryTest2Flow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" doc:name="HTTP"/>
<message-filter doc:name="Filter favicon">
<not-filter>
<wildcard-filter pattern="/favicon.ico" caseSensitive="true"/>
</not-filter>
</message-filter>
<objectstore:retrieve config-ref="ObjectStore" key="#[message.inboundProperties.key]" doc:name="ObjectStore"/>
<logger level="ERROR" doc:name="Logger"/>
</flow>
</mule>
我能否使用相同的键检索第一个流中存储的对象作为第二个 mule 流的一部分?
【问题讨论】:
标签: mule