Files
2021-01-12 23:30:48 +08:00

202 lines
6.6 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<Root>
<!--轮询发送-->
<!--
必需输入域:
选择输入域:
正常输出域:MSG_TYP|RSP_CD|
出错输出域:RSP_CD|
-->
<Transaction code="send">
<DynSentence name="query1">
<Sentence>
select MSG_NO,receiver,SND_TM,FAL_TMS,STS from pubsndjnl where
STS in ('0','1','3') AND CAST(FAL_TMS AS INT) &lt; %s
</Sentence>
<Fields>MAX_TMS|</Fields>
</DynSentence>
<DynSentence name="query2">
<Sentence>
select RCV_TYP,Addr,Para from pubsuber where name='%s'
</Sentence>
<Fields>Receiver|</Fields>
</DynSentence>
<!--DynSentence name="query3">
<Sentence>
select service from pubtra2sev where tramod='%s'
</Sentence>
<Fields>RCV_TYP|</Fields>
</DynSentence-->
<DynSentence name="query4">
<Sentence>
select head,body,message,file from pubmsgjnl where MSG_NO='%s'
</Sentence>
<Fields>MSG_NO|</Fields>
</DynSentence>
<DynSentence name="upd1"><!--修改状态为正在发起-->
<Sentence>
UPDATE pubsndjnl SET STS='1', SND_TM='%s' WHERE MSG_NO='%s' and
receiver='%s'
</Sentence>
<Fields>SND_TM|MSG_NO|receiver|</Fields>
</DynSentence>
<DynSentence name="upd3"><!--修改状态为发送失败状态或者超过最大失败次数状态-->
<Sentence>
UPDATE pubsndjnl SET STS='%s',FAL_TMS='%s' WHERE MSG_NO='%s' and
receiver='%s'
</Sentence>
<Fields>STS|FAL_TMS|MSG_NO|receiver|</Fields>
</DynSentence>
<DynSentence name="upd5"><!--修改状态为消息接收者不存在 停止发送-->
<Sentence>
UPDATE pubsndjnl SET STS='5' WHERE MSG_NO='%s' and receiver='%s'
</Sentence>
<Fields>MSG_NO|receiver|</Fields>
</DynSentence>
<DynSentence name="upd6"><!--修改状态为消息流水不存在 停止发送-->
<Sentence>
UPDATE pubsndjnl SET STS='6' WHERE MSG_NO='%s' and receiver='%s'
</Sentence>
<Fields>MSG_NO|receiver|</Fields>
</DynSentence>
<Attributes>
<Attribute name="nodatabase" value="2" /><!--全程数据库连接-->
</Attributes>
<FlowCtrl>
<Exec func="PUB:Lock">
<Arg name="RecKey" value="pubsndjnl" />
<Arg name="TimOut" value="60" />
<Arg name="AutoUnlock" value="yes" />
</Exec>
<!--Exec func="PUB:FreeMsgBody" error="IGNORE"/-->
<Exec func="PUB:OpenCursor" error="IGNORE">
<Arg name="SqlCmd" value="query1" />
</Exec>
<If condition="~RetCod=-1">
<Set>RSP_CD=99004</Set>
<Set>MSG_TYP=E</Set>
<Return />
</If>
<Set>count=0</Set>
<While condition="$count &lt; $MAX_FLX">
<Exec func="PUB:FetchCursor" />
<If condition="~RetCod=2">
<Break />
</If>
<Set>count=ADD($count,1)</Set>
<If
condition="OR(IS_EQUAL_STRING($STS,1),IS_EQUAL_STRING($STS,3))">
<Set>CurTim=GETDATETIME()</Set>
<Set>SubTim=SUB($CurTim,$SND_TM)</Set>
<If condition="INTCMP($SubTim,6,$ITV)=1">
<Set>FAL_TMS=ADD($FAL_TMS,1)</Set>
<If condition="INTCMP($FAL_TMS,5,$MAX_TMS)=1">
<Set>STS=4</Set>
</If>
<Else>
<Set>STS=3</Set>
</Else>
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="upd3" />
</Exec>
<If condition="~RetCod=0">
<Set>MSG_TYP=N</Set>
<Set>RSP_CD=000000</Set>
</If>
<Else>
<Continue />
</Else>
</If>
<Else>
<Continue />
</Else>
</If>
<Exec func="PUB:ReadRecord" error="IGNORE">
<Arg name="SqlCmd" value="query2" />
</Exec>
<If condition="~RetCod=2">
<Exec func="PUB:ExecSql">
<Arg name="SqlCmd" value="upd5" />
</Exec>
<Continue />
</If>
<Quote name="ErrorProc" />
<If condition="INTCMP($RCV_TYP,3,0)=1">
<Set>Service=$Addr</Set>
</If>
<Else>
<Exec func="PUB:CodeSwitching" error="IGNORE">
<Arg name="DatSrc" value="TRACSW" />
<Arg name="SourNam" value="RCV_TYP" />
<Arg name="DestNam" value="Service" />
<Arg name="TblNam" value="RcvTyp2Service" />
</Exec>
<If condition="~RetCod!=0">
<Set>RSP_CD=980006</Set>
<Set>MSG_TYP=E</Set>
<Return />
</If>
</Else>
<!--Exec func="PUB:ReadRecord">
<Arg name="SqlCmd" value="query3" />
</Exec>
<If condition="~RetCod=2">
<Continue/>
</If-->
<Exec func="PUB:ReadRecord">
<Arg name="SqlCmd" value="query4" />
</Exec>
<If condition="~RetCod=2">
<Exec func="PUB:ExecSql">
<Arg name="SqlCmd" value="upd6" />
</Exec>
<Continue />
</If>
<!--Set>@MSG.TTC=PubsubReply</Set>
<Set>@MSG.REV=$Receiver</Set>
<Set>@MSG.MSG=$MSG_NO</Set-->
<Set>SND_TM=GETDATETIME()</Set>
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="upd1" />
</Exec>
<If condition="~RetCod!=0">
<Set>MSG_TYP=E</Set>
<Continue />
</If>
<!--If condition="INTCMP($RCV_TYP,3,3)=1">
<Set>@MSG.OIP=GETWORDDELIMITER($Addr,:,1)</Set>
<Set>@MSG.OPT=GETWORDDELIMITER($Addr,:,2)</Set>
</If-->
<Exec func="PUB:InvokeService" error="IGNORE">
<Arg name="ServiceName" value="$Service" />
<Arg name='Mode' value='ASYNC' />
<Arg name="LogID" value="S.TRASVR" />
</Exec>
<If condition="~RetCod!=0">
<Set>FAL_TMS=ADD($FAL_TMS,1)</Set>
<If condition="INTCMP($FAL_TMS,5,$MAX_TMS)=1">
<Set>STS=4</Set>
</If>
<Else>
<Set>STS=3</Set>
</Else>
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="upd3" />
</Exec>
<Continue />
</If>
</While>
<Exec func="PUB:CloseCursor" />
<Exec func="PUB:Unlock">
<Arg name="RecKey" value="pubsndjnl" />
</Exec>
<Set>MSG_TYP=N</Set>
<Set>RSP_CD=000000</Set>
</FlowCtrl>
</Transaction>
</Root>