0
是否可以使用org.mule.module.mongo.MongoObjectStore作爲流中的緩存策略?使用Mongo DB的Mule緩存策略
我試圖用下面的,但我得到的錯誤
空(顯示java.lang.NullPointerException)
org.mule.module.mongo.MongoObjectStore:382(空)。
<mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.0" 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.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
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/2.0/mule-mongo.xsd">
<ee:object-store-caching-strategy name="Mongo_Caching_Strategy" doc:name="Caching Strategy">
<custom-object-store class="org.mule.module.mongo.MongoObjectStore">
<spring:property name="host" value="localhost"/>
<spring:property name="port" value="27017"/>
<spring:property name="database" value="test"/>
</custom-object-store>
</ee:object-store-caching-strategy>
<flow name="htmlCacheFlow" doc:name="htmlCacheFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" path="cache" doc:name="HTTP"/>
<expression-transformer expression="#[payload.substring(payload.lastIndexOf('/') + 1)]" doc:name="Expression"/>
<ee:cache doc:name="Cache" cachingStrategy-ref="Mongo_Caching_Strategy" >
<logger message="getting item from db for key #[payload]" level="INFO" doc:name="Logger"/>
<expression-transformer expression="#[payload + 'asd']" doc:name="Expression"/>
</ee:cache>
</flow>
</mule>
任何人都可以提供關於如何配置它的例子嗎?
感謝您的回覆,但不幸的是,當它試圖將store屬性設置爲MongoCloudConnectorConnectionManager而不是MongoObjectStore時發生錯誤。 – Stuart
道歉,我想到Redis連接器,連接器也是一個對象存儲 - Mongo,正如你所說的那樣,它有一個單獨的對象存儲類。我已經修改了答案。 –
再次感謝,這看起來不錯,但我不能得到名稱空間來識別mos作爲mule-mongo-object-store.xsd位置,因爲它不包含在引用的mule.module.mongo-3.4.0.jar中META-INF spring.schemas文件並且不存在於指定的地址。對不起,如果我錯過了明顯的東西。 – Stuart