fix协议介绍6-重发消息
来源:互联网 发布:软件测试自学教程视频 编辑:程序博客网 时间:2024/05/19 06:38
FIX.5.0SP2 Message
ResendRequest [type '2']
The resend request is sent by the receiving application to initiate the retransmission of messages. This function is utilized if a sequence number gap is detected, if the receiving application lost a message, or as a function of the initialization process.
Added FIX.2.7
Expand Components | Collapse Components
MsgType = 2
7BeginSeqNo 16EndSeqNo ComponentStandardTrailer重发消息实现:
package cs.mina.codec.msg;import java.util.HashSet;import java.util.List;import java.util.Set;import cs.mina.exception.InValidDataException;/* *@author(huangxiaoping) *@date 2013-11-28 */public class ResendRequestMsg extends BaseMsg {private Tag beginSeqNo = new Tag("7", "SeqNum", true);private Tag endSeqNo = new Tag("16", "SeqNum", true);private Set<String> tagIdsSet = new HashSet<String>();public ResendRequestMsg() {this.getHeadEntity().getMsgType().setTagValue("2");tagIdsSet.add("7");tagIdsSet.add("16");this.getBodyEntity().getBodyTagList().add(beginSeqNo);this.getBodyEntity().getBodyTagList().add(endSeqNo);}@Overridepublic void decodeBody() {Set<String> already=new HashSet<String>();String[] bodyItems=this.body.split(BaseMsg.SOH);if(bodyItems.length==1&&bodyItems[0].equals("")){return;}for(int i=0;i<bodyItems.length;i++){String[]tagItems=bodyItems[i].split("=");if(tagItems.length!=2){throw new InValidDataException("消息格式错误");}String tagId=tagItems[0];if(already.contains(tagId)){throw new InValidDataException("消息格式错误");}already.add(tagId);if(this.tagIdsSet.contains(tagId)){List<Tag> tagList=this.bodyEntity.getBodyTagList();for(int j=0;j<tagList.size();j++){Tag tag=tagList.get(j);if(tag.getTagId().equals(tagId)){tag.setTagValue(tagItems[1]);break;}}}else{throw new InValidDataException("消息格式错误,"+tagId+"不在消息体内");}}}@Overridepublic void validate() {this.headEntity.validate();List<Tag> bodyTagList=this.bodyEntity.getBodyTagList();for(int i=0;i<bodyTagList.size();i++){bodyTagList.get(i).validate();}this.tailerEntity.validate();}public Tag getBeginSeqNo() {return beginSeqNo;}public void setBeginSeqNo(Tag beginSeqNo) {this.beginSeqNo = beginSeqNo;}public Tag getEndSeqNo() {return endSeqNo;}public void setEndSeqNo(Tag endSeqNo) {this.endSeqNo = endSeqNo;}public Set<String> getTagIdsSet() {return tagIdsSet;}public void setTagIdsSet(Set<String> tagIdsSet) {this.tagIdsSet = tagIdsSet;}}
处理逻辑:略
0 0
- fix协议介绍6-重发消息
- fix协议介绍2-登入消息
- fix协议介绍3-登出消息
- fix协议介绍5-测试消息
- fix协议介绍8-Reject消息
- fix协议介绍-常用资源
- fix协议介绍4-心跳
- fix协议介绍20-TradeCaptureReportAck
- Fix协议封装挑战-消息处理
- fix协议中消息尾校验方法
- fix协议介绍7-序列号重置
- 消息重发机制
- fix协议封装挑战-将消息字符串解析为实体
- ActiveMQ的消息重发机制
- fix协议介绍9-下单(NewOrderSingle)
- Fix协议介绍10-取消订单请求(OrderCancelRequest)
- fix协议介绍11-修改订单(OrderCacelReplaceRequest)
- fix协议介绍12-取消订单被拒(OrderCacelReject)
- HDOJ 1069 Monkey and Banana(LIS)
- mac系统如何显示和隐藏文件
- sky 数
- VS2008下面将 CString转化为char* 的问题
- ubuntu没有开启cron日志
- fix协议介绍6-重发消息
- Android的RelativeLayout的view的layout_marginBottom不起作用
- sqlplus 远程操作orcl
- 火狐FlashPlayerPlugin应用程序发送异常解决办法
- UIEdgeInsets
- xhprof使用笔记
- ubuntu远程登陆windows
- nginx
- cocos2dx之CCRotateTo、CCRotateBy