首页 > 其他分享 >fix协议介绍8-Reject消息

fix协议介绍8-Reject消息

时间:2022-10-10 14:31:52浏览次数:43  
标签:协议 sessionRejectReason fix add Tag void Reject new public


FIX.5.0SP2 Message

Reject [type '3']



The reject message should be issued when a message is received but cannot be properly processed due to a session-level rule violation. An example of when a reject may be appropriate would be the receipt of a message with invalid basic data which successfully passes de-encryption, CheckSum and BodyLength checks.




Added  FIX.2.7

Expand Components | Collapse Components

fix协议介绍8-Reject消息_git

fix协议介绍8-Reject消息_ide_02

fix协议介绍8-Reject消息_java_03

fix协议介绍8-Reject消息_git_04



消息实现:

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-25
*/
public class RejectMsg extends BaseMsg {
private Tag refSeqNum=new Tag("45","SeqNum",true);
private Tag refTagID=new Tag("371","int",false);
private Tag refMsgType=new Tag("372","String",false);
private Tag sessionRejectReason=new Tag("373","int",false);
private Tag text=new Tag("58","String",false);
private Tag encodedTextLen=new Tag("354","Length",false);
private Tag encodedText=new Tag("355","data",false);
private Set<String> tagIdsSet=new HashSet<String>();
public RejectMsg(){
this.getHeadEntity().getMsgType().setTagValue("3");
tagIdsSet.add("45");
tagIdsSet.add("371");
tagIdsSet.add("372");
tagIdsSet.add("373");
tagIdsSet.add("58");
tagIdsSet.add("354");
tagIdsSet.add("355");
this.getBodyEntity().getBodyTagList().add(refSeqNum);
this.getBodyEntity().getBodyTagList().add(refTagID);
this.getBodyEntity().getBodyTagList().add(refMsgType);
this.getBodyEntity().getBodyTagList().add(sessionRejectReason);
this.getBodyEntity().getBodyTagList().add(text);
this.getBodyEntity().getBodyTagList().add(encodedTextLen);
this.getBodyEntity().getBodyTagList().add(encodedText);
}
@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("消息格式错误");
}
}

}

@Override
public void validate() {
if(refMsgType.getTagValue()!=null){
if(MsgUtil.msgTypeMap.get(refMsgType.getTagValue())==null){
throw new InValidDataException("refMsgType错误");
}
}
if(sessionRejectReason.getTagValue()!=null){
if(!MsgUtil.sessionRejectReason.contains(sessionRejectReason.getTagValue())){
throw new InValidDataException("sessionRejectReason错误");
}
}
if(encodedText.getTagValue()!=null){
encodedTextLen.setMust(true);
}
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 getRefSeqNum() {
return refSeqNum;
}

public void setRefSeqNum(Tag refSeqNum) {
this.refSeqNum = refSeqNum;
}

public Tag getRefTagID() {
return refTagID;
}

public void setRefTagID(Tag refTagID) {
this.refTagID = refTagID;
}

public Tag getRefMsgType() {
return refMsgType;
}

public void setRefMsgType(Tag refMsgType) {
this.refMsgType = refMsgType;
}

public Tag getSessionRejectReason() {
return sessionRejectReason;
}

public void setSessionRejectReason(Tag sessionRejectReason) {
this.sessionRejectReason = sessionRejectReason;
}

public Tag getText() {
return text;
}

public void setText(Tag text) {
this.text = text;
}

public Tag getEncodedTextLen() {
return encodedTextLen;
}

public void setEncodedTextLen(Tag encodedTextLen) {
this.encodedTextLen = encodedTextLen;
}

public Tag getEncodedText() {
return encodedText;
}

public void setEncodedText(Tag encodedText) {
this.encodedText = encodedText;
}

}


消息处理:略


标签:协议,sessionRejectReason,fix,add,Tag,void,Reject,new,public
From: https://blog.51cto.com/u_11979904/5743367

相关文章

  • RFID Gen2协议Session含义
    RFIDGen2协议中Session参数主要为了方便标签盘点。每个标签都包含s0-s3总计4种session,每种session中又各有A,B两种inventoriedflag,这些flag在不同Session之间不互通。换......
  • DFP 数据转发协议应用实例 3.LoRA 中继-使用频道实现
    DFP数据转发协议应用实例 3.LoRA中继-使用频道实现DFP是什么?稳控科技编写的一套数据转发规则,取自“自由转发协议FFP(FreeForwardProtocol)”,或者DFP(DoubleFProt......
  • 如何实现汇川PLC和工业机器人的协议解析与数据采集?
    汇川是一家专注于工业自动化的设备制造商,具备一整套完善的产品与服务,涉及变频器、伺服系统、PLC、HMI触摸屏、电动汽车电机控制器、光伏逆变器等等,在制造业、新能源、环保节......
  • 实验3:OpenFlow协议分析实践
    拓扑文件:  ping截图:   抓包:1.hello  6633接口发送到交换机40276接口,openflow版本1.0  交换机40276接口发送到控制器6633接口,openflow版本1.5双......
  • 实验3:OpenFlow协议分析实践
    实验3:OpenFlow协议分析实践一、实验目的能够运用wireshark对OpenFlow协议数据交互过程进行抓包;能够借助包解析工具,分析与解释OpenFlow协议的数据包交互过程与......
  • 实验3:OpenFlow协议分析实践
    实验3:OpenFlow协议分析实践一、实验目的能够运用wireshark对OpenFlow协议数据交互过程进行抓包;能够借助包解析工具,分析与解释OpenFlow协议的数据包交互过程与机制......
  • 实验3:OpenFlow协议分析实践
    1.搭建下图所示拓扑,完成相关IP配置,并实现主机与主机之间的IP通信。用抓包软件获取控制器与交换机之间的通信数据。2.查看抓包结果,分析OpenFlow协议中交换机与控制器......
  • 实验3:OpenFlow协议分析实践
    1.搭建下图所示拓扑,完成相关IP配置,并实现主机与主机之间的IP通信。用抓包软件获取控制器与交换机之间的通信数据。2.查看抓包结果,分析OpenFlow协议中交换机与控制器......
  • 实验3:OpenFlow协议分析实践
    一、实验目的1.能够运用wireshark对OpenFlow协议数据交互过程进行抓包;2.能够借助包解析工具,分析与解释OpenFlow协议的数据包交互过程与机制。二、实验环境Ubuntu......
  • 实验3:OpenFlow协议分析实践
    一、实验目的1.能够运用wireshark对OpenFlow协议数据交互过程进行抓包;2.能够借助包解析工具,分析与解释OpenFlow协议的数据包交互过程与机制。二、实验环境Ubuntu......