我已经尝试将缓存中介器实现为顺序以及主要但我不认为缓存已经很好地实现了。这是序列代码:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="demoSequence">
<in>
<log>
<property name="AmitProp" value="----ATSEQUENCECACHE-------------------------"/>
</log>
<payloadFactory>
<format>
<p:getQuote xmlns:p="http://services.samples">
<ax23:request xmlns:ax23="http://services.samples">
<xs:symbol xmlns:xs="http://services.samples/xsd">IBM</xs:symbol>
</ax23:request>
</p:getQuote>
</format>
</payloadFactory>
<cache id="mycache" scope="per-host" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="5000" maxMessageSize="100000">
<implementation type="memory" maxSize="999999999"/>
</cache>
<send>
<endpoint key="demoEP"/>
</send>
</in>
<out>
<log>
<property name="amitProp" value="--------ATCACHEOUT----------------------------------------------"/>
</log>
<cache id="mycache" scope="per-host" collector="true"/>
<send/>
</out>
</sequence>
and my main sequence is:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="main">
<log level="full"/>
<in>
<switch xmlns:ns="http://org.apache.synapse/xsd" source="get-property('To')">
<case regex=".*/demoSeq">
<log>
<property name="amitProperty" value="------InCase1----------------------------------------------------"/>
</log>
<cache id="mycache" scope="per-host" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="5000" maxMessageSize="100000">
<implementation type="memory" maxSize="999999999"/>
<sequence key="demoSequence"/>
</case>
<case regex=".*/demoSeqForStock">
<log>
<property name="amitProp" value="---------------------inCase2----------------------------------------"/>
</log>
<sequence key="demoSimpleStockSequence"/>
</case>
</switch>
</in>
<out>
<cache id="mycache" scope="per-host" collector="true"/>
<log>
<property name="amitProperty" value="------beforeSEND----------------------------------------------------"/>
</log>
<send/>
<log>
<property name="amitProperty" value="------afterSEND----------------------------------------------------"/>
</log>
</out>
<drop/>
</sequence>
我在这方面做错了什么,有没有与缓存中介有关的例子?