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.
重发消息实现:
cs.mina.codec.msg; java.util.HashSet; java.util.List; java.util.Set; cs.mina.exception.InValidDataException; BaseMsg { Tag beginSeqNo Tag(, , ); Tag endSeqNo Tag(, , ); Set tagIdsSet HashSet(); ResendRequestMsg() { .getHeadEntity().getMsgType().setTagValue(); tagIdsSet.add(); tagIdsSet.add(); .getBodyEntity().getBodyTagList().add(beginSeqNo); .getBodyEntity().getBodyTagList().add(endSeqNo); } decodeBody() { Set already HashSet(); [] bodyItems.body.split(BaseMsg.SOH); (bodyItems.lengthbodyItems[].equals()){ ; } ( i;ibodyItems.length;i){ []tagItemsbodyItems[i].split(); (tagItems.length){ InValidDataException(); } tagIdtagItems[]; (already.contains(tagId)){ InValidDataException(); } already.add(tagId); (.tagIdsSet.contains(tagId)){ ListTag tagList.bodyEntity.getBodyTagList(); ( j;jtagList.size();j){ Tag tagtagList.get(j); (tag.getTagId().equals(tagId)){ tag.setTagValue(tagItems[]); ; } } }{ InValidDataException(tagId); } } } validate() { .headEntity.validate(); ListTag bodyTagList.bodyEntity.getBodyTagList(); ( i;ibodyTagList.size();i){ bodyTagList.get(i).validate(); } .tailerEntity.validate(); } Tag getBeginSeqNo() { beginSeqNo; } setBeginSeqNo(Tag beginSeqNo) { .beginSeqNo beginSeqNo; } Tag getEndSeqNo() { endSeqNo; } setEndSeqNo(Tag endSeqNo) { .endSeqNo endSeqNo; } Set getTagIdsSet() { tagIdsSet; } setTagIdsSet(Set tagIdsSet) { .tagIdsSet tagIdsSet; } }