【发布时间】:2015-12-02 11:00:53
【问题描述】:
我正在尝试为 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 连接器。
连接器 - <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>
但我得到了错误:
java.lang.IllegalStateException:无法将类型 [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>
但我遇到了同样的错误。
【问题讨论】: