如何在mule应用程序之间共享数据;t使用数据库(使用对象存储)

如何在mule应用程序之间共享数据;t使用数据库(使用对象存储),mule,persistent-object-store,Mule,Persistent Object Store,在mule中使用对象存储时出现问题。它无法与同一mule服务器上的其他应用共享数据。我已设置如下,但无法在其他应用程序(同一服务器)中使用 谁能解决这个问题,请帮帮我 非常感谢你 随着Mule 3.5的推出,出现了可用于在应用程序之间共享资源的域的概念(尽管Mule文档中描述了一些限制)。在本例中,您希望共享对象存储Springbean 为了在Mule 3.5中做到这一点,您应该创建一个域: 在$MULE_HOME/domains(例如$MULE/domains/mydomain)下创建文件

在mule中使用对象存储时出现问题。它无法与同一mule服务器上的其他应用共享数据。我已设置如下,但无法在其他应用程序(同一服务器)中使用


谁能解决这个问题,请帮帮我


非常感谢你

随着Mule 3.5的推出,出现了可用于在应用程序之间共享资源的域的概念(尽管Mule文档中描述了一些限制)。在本例中,您希望共享对象存储Springbean

为了在Mule 3.5中做到这一点,您应该创建一个域:

  • 在$MULE_HOME/domains(例如$MULE/domains/mydomain)下创建文件夹
  • 创建一个名为mule-domain-config.xml的文件,该文件应包含您案例中的域配置,它应如下所示:
  • 
    
    然后您需要创建一个使用域的应用程序。为此:

  • 在studio中创建新项目
  • 在mule-deploy.properties中编辑域属性这应该是 设置为域名(例如mydomain)
  • 还要确保在对象存储配置中引用了正确的对象存储bean(在本例中为myListableObjectStore)
  • 应用程序的代码应类似于:

    <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.5.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="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/current/mule-objectstore.xsd
    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">
    
    
    
        <objectstore:config name="ObjectStore"
            objectStore-ref="myListableObjectStore" 
             />
    
    
    
    <flow name="store" doc:name="store">
    <http:inbound-endpoint address="http://localhost:8085" doc:name="HTTP"/>
    <objectstore:store config-ref="ObjectStore" key="abc" value-ref="#[payload]" doc:name="ObjectStore"/>
    </flow>
    
    
    <flow name="retrieve" doc:name="retrieve">
    <http:inbound-endpoint address="http://localhost:8084" doc:name="HTTP"/>
    <objectstore:retrieve key="abc" config-ref="ObjectStore" doc:name="ObjectStore"/>
    </flow>
    

    
    

    此应用程序可以部署到通常的$MULE_HOME/apps目录,也可以部署到域文件夹下

    要测试此功能,请部署另一个从对象存储中读取检索的应用程序,例如:

    <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.5.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="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/current/mule-objectstore.xsd
    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">
    
    
    
        <objectstore:config name="ObjectStore"
            objectStore-ref="myListableObjectStore" 
             />
    
    
    <flow name="retrieve" doc:name="retrieve">
    <http:inbound-endpoint address="http://localhost:8081" doc:name="HTTP"/>
    <objectstore:retrieve key="abc" config-ref="ObjectStore" doc:name="ObjectStore"/>
    </flow>
    

    
    


    然后点击
    http://localhost:8085/mypayload
    当您点击
    http://localhost:8081
    您应该在浏览器中看到/mypayload。

    您是在CE还是EE上?在CE上,您可以创建一个由Hazelcast支持的自定义对象存储。@David Dossot:我使用了mule mule EE 3.4.1。我将尝试您的解决方案,但您是否有Hazelcast支持的自定义对象存储的任何示例。你能和我分享一下吗?对不起,Tran,我没有现成的例子。Hazelcast非常容易使用,所以它应该不会太难做到。如果我有时间,我会自己做的!谢谢安德烈·谢姆布里。但是我使用Mule EE 3.4.1(不是最新的),所以我不能这样做:(
    <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.5.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="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/current/mule-objectstore.xsd
    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">
    
    
    
        <objectstore:config name="ObjectStore"
            objectStore-ref="myListableObjectStore" 
             />
    
    
    <flow name="retrieve" doc:name="retrieve">
    <http:inbound-endpoint address="http://localhost:8081" doc:name="HTTP"/>
    <objectstore:retrieve key="abc" config-ref="ObjectStore" doc:name="ObjectStore"/>
    </flow>