105 lines
3.3 KiB
XML
105 lines
3.3 KiB
XML
<?xml version='1.0' encoding='UTF-8'?>
|
|
<Root>
|
|
<!--对发送失败的消息重新发送-->
|
|
<Transaction code="re_send_msg" desc="send message again" log_switch="1">
|
|
|
|
<DynSentence name="readMsg"> <!--读取需重发的消息-->
|
|
<Sentence>
|
|
select * from pubsnderr where MAX_SND_TMS > '1' and MSG_STS='0'
|
|
</Sentence>
|
|
|
|
</DynSentence>
|
|
|
|
<DynSentence name="readSuber"> <!--获取订阅者信息-->
|
|
<Sentence>
|
|
select OBJ_SVR,TTXN_CD from pubsuber where SUB_ID=?
|
|
</Sentence>
|
|
<Fields>SUB_ID</Fields>
|
|
</DynSentence>
|
|
|
|
<DynSentence name="updMsgSts"> <!--更新重发消息状态-->
|
|
<Sentence>
|
|
update pubsnderr set MSG_STS=?,SND_TM=?,SND_TMS=? where MSG_ID=?
|
|
</Sentence>
|
|
<Fields>MSG_STS|SND_TM|SND_TMS|MSG_ID</Fields>
|
|
</DynSentence>
|
|
|
|
<Attributes>
|
|
<Attribute name="nodatabase" value="2" />
|
|
</Attributes>
|
|
|
|
<FlowCtrl>
|
|
|
|
<Exec func="PUB:OpenCursor" error="IGNORE">
|
|
<Arg name="SqlCmd" value="readMsg"/>
|
|
</Exec>
|
|
<If condition="~RetCod=-1">
|
|
<Return/>
|
|
</If>
|
|
|
|
<Exec func="PUB:Lock">
|
|
<Arg name="RecKey" value="$TXN_CD"/>
|
|
<Arg name="TimOut" value="300"/>
|
|
</Exec>
|
|
|
|
<Set>count=0</Set>
|
|
<Set>MAX_FLX=300</Set> <!--进行流量控制-->
|
|
|
|
<While condition="$count < $MAX_FLX">
|
|
<Exec func="PUB:FetchCursor" error="IGNORE"/>
|
|
<If condition="~RetCod=2">
|
|
<Break/>
|
|
</If>
|
|
<ElseIf condition="~RetCod=-1">
|
|
<Exec func="PUB:CloseCursor"/>
|
|
<Exec func="PUB:UnLock">
|
|
<Arg name="RecKey" value="$TXN_CD"/>
|
|
</Exec>
|
|
<Return/>
|
|
</ElseIf>
|
|
|
|
<!--查询订阅者的服务码和交易码-->
|
|
<Exec func="PUB:ReadRecord" error="IGNORE">
|
|
<Arg name="SqlCmd" value="readSuber"/>
|
|
</Exec>
|
|
<If condition="~RetCod!=0">
|
|
<Continue/>
|
|
</If>
|
|
|
|
<Exec func="PUB:CallThirdService" error="IGNORE">
|
|
<Arg name="HTxnCd" value="$TTXN_CD"/>
|
|
<Arg name="ObjSvr" value="$OBJ_SVR"/>
|
|
<arg name="In" value="MSG_DAT"/>
|
|
</Exec>
|
|
|
|
<If condition="~RetCod=0">
|
|
<Set>SND_TMS=ADD($SND_TMS,1)</Set>
|
|
<Set>MSG_STS=1</Set>
|
|
</If>
|
|
<Else>
|
|
<Set>SND_TMS=ADD($SND_TMS,1)</Set>
|
|
<If condition="INTCMP($SND_TMS,5,$MAX_SND_TMS)">
|
|
<Set>MSG_STS=2</Set>
|
|
</If>
|
|
<Else>
|
|
<Set>MSG_STS=0</Set>
|
|
</Else>
|
|
</Else>
|
|
|
|
|
|
<Set>SND_TM=GETSECOND()</Set>
|
|
<Exec func="PUB:ExecSql" error="IGNORE">
|
|
<Arg name="SqlCmd" value="updMsgSts"/>
|
|
</Exec>
|
|
|
|
<Set>count=ADD($count,1)</Set>
|
|
</While>
|
|
<Exec func="PUB:CloseCursor" error="IGNORE"/>
|
|
<Exec func="PUB:UnLock">
|
|
<Arg name="RecKey" value="$TXN_CD"/>
|
|
</Exec>
|
|
</FlowCtrl>
|
|
</Transaction>
|
|
</Root>
|
|
|