我正在使用 WSO2Esb 和 WSO2DSS 在数据库中插入读数 我的插入工作正常,而我正在从移动端获取请求读取我需要以 200 和唯一值响应,有时在插入后连接失败意味着插入结束但客户端没有得到响应在那种情况下,移动端客户端再次发送请求,所以我的代理再次将此请求发送到数据库。因此,我的数据库为每 2 或 3 个读数存储重复值,这对客户端完全不公平,因为我找到了一个小解决方案使用幂等服务我们可以找到解决方案
<!-- The example shows WSO2 ESB acting as an Idempotent Receiver -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="IdempotencyReceivingProxy">
<target>
<inSequence>
<log level="full"/>
<!-- Store all messages in an Jmsmemory message store -->
<store messageStore="MyStore"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
<!-- Further mediation of messages are done in this sequence -->
<sequence name="next_seq">
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
</sequence>
<messageStore name="MyStore"/>
<!-- Resequencing Processor takes the next sequence number and hand over to "next_seq" and preserve Idempotency -->
<messageProcessor
class="org.apache.synapse.message.processors.resequence.ResequencingProcessor"
name="ResequencingProcessor" messageStore="MyStore">
<parameter name="interval">2000</parameter>
<!-- Takes the sequence number using Xpath -->
<parameter name="seqNumXpath" xmlns:m0="http://services.samples" expression="substring-after(//m0:placeOrder/m0:order/m0:symbol,'-')"/>
<parameter name="nextEsbSequence">next_seq</parameter>
<parameter name="deleteDuplicateMessages">true</parameter>
</messageProcessor>
</definitions>
为此,我点击了此链接http://docs.wso2.org/wiki/display/IntegrationPatterns/Idempotent+Receiver 它是否适合我的要求