【发布时间】:2013-08-20 20:47:33
【问题描述】:
我正在使用 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 是否适合我的要求
【问题讨论】: