使用MongoDB的Mule缓存策略
我试图在mule中为特定请求实现缓存策略,与MongoDB一起使用 名称空间-使用MongoDB的Mule缓存策略,mongodb,caching,mule,Mongodb,Caching,Mule,我试图在mule中为特定请求实现缓存策略,与MongoDB一起使用 名称空间-xmlns:mongo=”http://www.mulesoft.org/schema/mule/mongo“ 模式位置-http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd 尝试两种方法: 1)我配置了MongoDB连接器 连接器- 缓存的对象存储- 但我
xmlns:mongo=”http://www.mulesoft.org/schema/mule/mongo“
模式位置-http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd
尝试两种方法:
1)我配置了MongoDB连接器
连接器-
缓存的对象存储-
但我得到了一个错误:
java.lang.IllegalStateException:无法将[org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionManager]类型的值转换为属性“store”所需的[org.mule.api.store.ObjectStore]类型:找不到匹配的编辑器或转换策略。
2)缓存的对象存储-(其他方式):
像这样-
但我也遇到了同样的错误。这个配置对我来说很有效,并使用Spring来实例化操作系统
<spring:beans>
<spring:bean id="mongoObjectStore" class="org.mule.module.mongo.MongoObjectStore"
init-method="initialize" scope="singleton">
<spring:property name="host" value="localhost"/>
<spring:property name="port" value="27017"/>
<spring:property name="database" value="test"/>
<spring:property name="username" value=""/>
<spring:property name="password" value=""/>
<spring:property name="writeConcern" value="DATABASE_DEFAULT"/>
</spring:bean>
</spring:beans>
<ee:object-store-caching-strategy
name="mongoCachingStrategy">
<spring-object-store ref="mongoObjectStore" />
</ee:object-store-caching-strategy>
它正在工作!!,我知道你用它来缓存,比如你在哪里配置了TTL?你知道些什么吗?这是一个单独的问题。我看到你打开了一个新的线程。如果您对此感到满意,您可以接受答案。我收到了以下错误:在项目“test”的生成路径上找不到类型“org.mule.module.mongo.MongoObjectStore”
,如何解决?您是否已将mule mongo模块添加为依赖项?