fix协议介绍8-Reject消息
2013-12-13 12:32
816 查看
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 successfullypasses de-encryption, CheckSum and BodyLength checks.
Added FIX.2.7
Expand Components | Collapse Components
Field or Component | Field Name | FIXML name | Req'd | Comments | Depr. |
---|
Component | StandardHeader | BaseHeader | MsgType = 3 |
45 | RefSeqNum | @RefSeqNum | MsgSeqNum of rejected message | |||
371 | RefTagID | @RefTagID | The tag number of the FIX field being referenced. | |||
372 | RefMsgType | @RefMsgTyp | The MsgType of the FIX message being referenced. | |||
1130 | RefApplVerID | @RefApplVerID | Recommended when rejecting an application message that does not explicitly provide ApplVerID ( 1128) on the message being rejected. In this case the value from the DefaultApplVerID(1137) or the default value specified in the NoMsgTypes repeating group on the logon message should be provided. | |||
1406 | RefApplExtID | @RefApplExtID | Recommended when rejecting an application message that does not explicitly provide ApplExtID(1156) on the rejected message. In this case the value from the DefaultApplExtID(1407) or the default value specified in the NoMsgTypes repeating group on the logon message should be provided. | |||
1131 | RefCstmApplVerID | @RefCstmApplVerID | Recommended when rejecting an application message that does not explicitly provide CstmApplVerID(1129) on the message being rejected. In this case the value from the DefaultCstmApplVerID(1408) or the default value specified in the NoMsgTypes repeating group on the logon message should be provided. | |||
373 | SessionRejectReason | Code to identify reason for a session-level Reject message. | ||||
58 | Text | @Txt | Where possible, message to explain reason for rejection | |||
354 | EncodedTextLen | @EncTxtLen | Must be set if EncodedText field is specified and must immediately precede it. | |||
355 | EncodedText | @EncTxt | Encoded (non-ASCII characters) representation of the Text field in the encoded format specified via the MessageEncoding field. |
Component | StandardTrailer |
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; } }
消息处理:略
相关文章推荐
- fix协议介绍3-登出消息
- fix协议介绍12-取消订单被拒(OrderCacelReject)
- fix协议介绍2-登入消息
- fix协议介绍5-测试消息
- fix协议介绍6-重发消息
- fix协议封装挑战-BusinessMessageRejectMessageHandler
- 消息处理利器 ActiveMQ 的介绍 & Stomp 协议的使用
- fix协议介绍9-下单(NewOrderSingle)
- [中间件] 消息处理利器 ActiveMQ 的介绍 & Stomp 协议的使用
- fix协议封装挑战-将消息字符串解析为实体
- Fix协议介绍10-取消订单请求(OrderCancelRequest)
- ESFramework介绍之(1)――网络通信消息协议接口IContract
- fix协议介绍11-修改订单(OrderCacelReplaceRequest)
- fix协议介绍14-批量取消订单(OrderMassCancelRequest)
- 无人机开发-介绍Mavlink协议的消息组成、如何看懂繁杂的mavlink官网介绍、简单介绍地面站与飞控的通讯流程
- ESFramework介绍之(1)――网络通信消息协议接口IContract
- fix协议介绍15-批量取消订单执行报告(OrderMassCancelReport)
- [中间件] 消息处理利器 ActiveMQ 的介绍 & Stomp 协议的使用
- fix协议介绍13-执行报告(ExecutionReport)
- fix协议介绍16-查询叮当(quote)