首页 > 其他分享 >fix协议介绍7-序列号重置

fix协议介绍7-序列号重置

时间:2022-10-10 14:32:19浏览次数:40  
标签:tagIdsSet fix 重置 tagId Tag newSeqNo new 序列号 public


FIX.5.0SP2 Message

SequenceReset [type '4']



The sequence reset message is used by the sending application to reset the incoming sequence number on the opposing side.



fix协议介绍7-序列号重置_ide


实现:

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-27
*/
public class SequenceResetMsg extends BaseMsg {
private Tag gapFillFlag=new Tag("123","Boolean",false);
private Tag newSeqNo=new Tag("36","SeqNum",true);

private Set<String> tagIdsSet=new HashSet<String>();

public SequenceResetMsg(){
tagIdsSet.add("123");
tagIdsSet.add("36");
this.getBodyEntity().getBodyTagList().add(gapFillFlag);
this.getBodyEntity().getBodyTagList().add(newSeqNo);
}

@Override
public void decodeBody() {
Set<String> already=new HashSet<String>();
String[] bodyItems=this.body.split(BaseMsg.SOH);
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+"不在消息体内");
}
}

}

@Override
public 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 getGapFillFlag() {
return gapFillFlag;
}

public void setGapFillFlag(Tag gapFillFlag) {
this.gapFillFlag = gapFillFlag;
}

public Tag getNewSeqNo() {
return newSeqNo;
}

public void setNewSeqNo(Tag newSeqNo) {
this.newSeqNo = newSeqNo;
}

public Set<String> getTagIdsSet() {
return tagIdsSet;
}

public void setTagIdsSet(Set<String> tagIdsSet) {
this.tagIdsSet = tagIdsSet;
}

}





标签:tagIdsSet,fix,重置,tagId,Tag,newSeqNo,new,序列号,public
From: https://blog.51cto.com/u_11979904/5743365

相关文章

  • fix协议介绍8-Reject消息
    FIX.5.0SP2MessageReject [type'3']Therejectmessageshouldbeissuedwhenamessageisreceivedbutcannotbeproperlyprocessedduetoasession-levelr......
  • docker gitlab 用户密码重置
    代码按照顺序dockerexec-itgitlabbashsu-gitls进入控制台--以下根据版本两条都试试gitlab-railsconsoleproduction或者gitlab-railsconsole-eproduction......
  • centos7.x重置系统密码
      centos7单用户模式更改计算机密码重启——在第一行按e——找到linux16的一行,在最后面加上rd.break(如果是虚拟机还需要加上console=tty0)——ctrl+x重......
  • PriceFixed
    传送门题意:市场上有\(a[i]\)种商品,每种商品的价格都是\(2\)。现在你需要买这种商品\(a[i]\)件。但是对于第\(i\)种商品有一个属性\(bi\),意味着如果你已经买了\(bi......
  • 为什么每次建立 TCP 连接时,初始化的序列号都要求不一样呢?
    为什么每次建立TCP连接时,初始化的序列号都要求不一样呢?主要原因有两个方面:为了防止历史报文被下一个相同四元组的连接接收(主要方面);为了安全性,防止黑客伪造的相同序列......
  • 前端妹子问我 position fixed 失效问题该如何解决?
    背景这两天公司一位妹子问我,“我这边调试的时候本地显示没问题,到手机端就有问题,该怎么办呢?”测试环境没问题到线上就有问题了?对此我也很纳闷。下图是复现的效果图,这个是一......
  • D. Prefixes and Suffixes
    题意给定两个长度为\(n\)的字符串,\(k\in[1,n]\),你可以把其中一个字符串长度为\(k\)的前缀与另一个字符串长度为\(k\)的后缀交换,问能不能通过若干次操作,使两个字符串完全......
  • 【Linux】Unable to fetch some archives, maybe run apt-get update or try with --f
    一、问题描述在aptinstall时候遇到E:Unabletofetchsomearchives,mayberunapt-getupdateortrywith--fix-missing?的error。Error报的信息显示是这个包向so......
  • CF1526E Oolimry and Suffix Array 组合数学
    看起来是后缀数组,但是看到求方案数就是dp,计数啥的了问满足后缀数组的字符串方案有多少观察样例,发现rk相邻的所在位置,字母要么是相等,要么是比其大大的话条件直接满足了,相......
  • 宝塔linux面板重启、重置等命令
    安装宝塔Centos安装脚本yuminstall-ywget&&wget-Oinstall.shhttp://download.bt.cn/install/install.sh&&shinstall.shUbuntu/Deepin安装脚本wget-Oinsta......