2017-10-21 170 views
0

我无法读取App1中存储在Object Store中的密钥的值。在mule中无法从对象存储中检索不同应用程序中的值

我有2个应用程序,App1将变量的值(如'name')存储到某个值(比如'abc')。从App2开始,我想要检索键的值(在我们的例子中是'name'),但它总是失败,出现org.mule.api.store.ObjectDoesNotExistException。

如果两个流程都在同一个应用程序上,它可以工作,但这不是预期的行为。

这两个应用程序都运行在同一个运行时,因此它应该能够检索该值。

下面是我对APP

<flow name="objectstore1Flow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/retrieve" allowedMethods="GET" doc:name="HTTP"/> 
    <set-variable value="abc" variableName="name" doc:name="Variable" /> 
    <objectstore:store config-ref="ObjectStore__Connector" key="name" value-ref="#[flowVars.name]" doc:name="ObjectStore" /> 
</flow> 

代码代码应用2

<flow name="objectstore2Flow"> 
    <http:listener config-ref="gcc-httpDomainListenerConfig" path="/store2" allowedMethods="GET" doc:name="HTTP"/> 
    <objectstore:retrieve config-ref="ObjectStore__Connector" key="name" doc:name="ObjectStore" targetScope="INVOCATION"/> 
    <logger message="Value of name from cache is : #[payload]" level="INFO" doc:name="Logger"/> 
</flow> 

两个应用程序对象存储的配置是:

有人可以指导我,在那里我错了?

回答

1

主要原因是应用程序彼此独立并使用自己的内存存储来保存数据。
因此,当您的数据存储在其自己的内存中时,它不可用于app2,因为它独立使用其自己的内存。
这两个应用程序都指向它自己的Object Store配置。

共享对象存储将是你将在域中定义对象存储,并且将它的所有子应用程序,如APP1之间共享域项目的解决方案,APP2APP3

按照步骤在这里你可以怎么做: - http://bushorn.com/dealing-with-store-the-object-store/

用于持久化的ObjectStore使用_defaultUserObjectStore持续选项编号:https://docs.mulesoft.com/mule-user-guide/v/3.9/object-store-connector#persistingdata

+0

我确实尝试过在bushorn.com中提到的方式,但没有奏效。您的评论后,我重新启动我的工作室后尝试,现在奇怪它的工作。 我假设它不能存在,否则我会得到ObjectAlreadyExist异常,可能是我以前做错了。 感谢您的建议,现在正在工作,现在将在群集Mule框中检查此问题。 – user4338724

相关问题