我试图在MongoDB中为特定的请求实现缓存策略。
命名空间- xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo"
schemalocation - http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd
尝试2种方法:
1) i配置了MongoDB连接器。
连接器- <mongo:config name="Mongo_DB" doc:name="Mongo DB" database="test" username="test"/>
对象存储,用于缓存-
<ee:object-store-caching-strategy name="Mongo_DB_Caching_Strategy" doc:name="Caching Strategy"> <spring-object-store ref="Mongo_DB" /> </ee:object-store-caching-strategy>
但我发现了错误:
无法将org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionManager类型的值转换为属性“存储”所需的类型org.mule.api.store.ObjectStore :没有找到匹配的编辑器或转换策略。
2)缓存的对象存储-(其他方式):
像这样- Mule Caching Strategy using Mongo DB
<ee:object-store-caching-strategy name="Mongo_DB_Caching_Strategy" doc:name="Caching Strategy"> <custom-object-store class="org.mule.module.mongo.MongoObjectStore"> <spring:property name="database" value="test"/> <spring:property name="host" value="localhost"/> <spring:property name="port" value="27017"/> <spring:property name="username" value="test"/> </custom-object-store> </ee:object-store-caching-strategy>
但我也犯了同样的错误。
发布于 2015-12-02 07:12:45
此配置对我有效,并使用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>
https://stackoverflow.com/questions/34041081
复制相似问题