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
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;
}
}
消息处理:略