使用mongodb的Mule缓存策略

使用mongodb的Mule缓存策略,mongodb,mule,mule-studio,Mongodb,Mule,Mule Studio,是否可以将org.mule.module.mongo.MongoObjectStore用作流中的缓存策略 我已尝试以下操作,但出现错误 null(java.lang.NullPointerException) org.mule.module.mongo.MongoObjectStore:382(空) 有人能提供一个如何配置它的示例吗?试试这个: <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="h

是否可以将org.mule.module.mongo.MongoObjectStore用作流中的缓存策略

我已尝试以下操作,但出现错误

null(java.lang.NullPointerException)
org.mule.module.mongo.MongoObjectStore:382(空)


有人能提供一个如何配置它的示例吗?

试试这个:

    <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mos="http://www.mulesoft.org/schema/mule/mongo-object-store"
        xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:script="http://www.mulesoft.org/schema/mule/scripting"
        xmlns:test="http://www.mulesoft.org/schema/mule/test" xmlns:spring="http://www.springframework.org/schema/beans"
        xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
        xsi:schemaLocation="
              http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
              http://www.mulesoft.org/schema/mule/mongo-object-store http://www.mulesoft.org/schema/mule/mongo-object-store/current/mule-mongo-object-store.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/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
              http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/current/mule-test.xsd
              http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">

      <mos:config name="mos" database="test" />

      <ee:object-store-caching-strategy name="Mongo_Caching_Strategy">
           <spring-object-store ref="mos" />
        </ee:object-store-caching-strategy> 
    </mule>

请注意mos的特定名称空间。

尝试以下操作:

    <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mos="http://www.mulesoft.org/schema/mule/mongo-object-store"
        xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:script="http://www.mulesoft.org/schema/mule/scripting"
        xmlns:test="http://www.mulesoft.org/schema/mule/test" xmlns:spring="http://www.springframework.org/schema/beans"
        xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
        xsi:schemaLocation="
              http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
              http://www.mulesoft.org/schema/mule/mongo-object-store http://www.mulesoft.org/schema/mule/mongo-object-store/current/mule-mongo-object-store.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/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
              http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/current/mule-test.xsd
              http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">

      <mos:config name="mos" database="test" />

      <ee:object-store-caching-strategy name="Mongo_Caching_Strategy">
           <spring-object-store ref="mos" />
        </ee:object-store-caching-strategy> 
    </mule>


请注意mos的特定名称空间。

感谢您的回复,但不幸的是,当它试图将存储属性设置为MongoCloudConnectorConnectionManager而不是MongoObjectStore时,出现了错误。抱歉,我想到了Redis连接器,其中连接器也是一个对象存储——正如您正确地说的,Mongo为objectstore提供了一个单独的类。我已经修改了答案。再次感谢,这看起来不错,但我无法将mos的名称空间识别为mule-mongo-object-store.xsd位置,因为它不包含在引用的mule.module.mongo-3.4.0.jar META-INF spring.schemas文件中,并且不存在于指定的地址。对不起,如果我遗漏了一些明显的东西。嗯,有一个错误@模块被注释掉,然后被删除,因此现在无法引用-。我将提出一个bug和一个pull请求。Ryan,从您之前的回答中,您提到了我现在正在查看的Redis。你能帮我回答这个问题吗?感谢您的回复,但不幸的是,当它试图将store属性设置为MongoCloudConnectorConnectionManager而不是MongoObjectStore时出现了错误。很抱歉,我想到的是Redis连接器,其中连接器也是一个对象存储—正如您正确地说的,Mongo为objectstore提供了一个单独的类。我已经修改了答案。再次感谢,这看起来不错,但我无法将mos的名称空间识别为mule-mongo-object-store.xsd位置,因为它不包含在引用的mule.module.mongo-3.4.0.jar META-INF spring.schemas文件中,并且不存在于指定的地址。对不起,如果我遗漏了一些明显的东西。嗯,有一个错误@模块被注释掉,然后被删除,因此现在无法引用-。我将提出一个bug和一个pull请求。Ryan,从您之前的回答中,您提到了我现在正在查看的Redis。你能帮我回答这个问题吗?