fix协议介绍2-登入消息

35 篇文章 0 订阅
34 篇文章 16 订阅

发布一个k8s部署视频:https://edu.csdn.net/course/detail/26967

课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。

腾讯课堂连接地址https://ke.qq.com/course/478827?taid=4373109931462251&tuin=ba64518

第二个视频发布  https://edu.csdn.net/course/detail/27109

腾讯课堂连接地址https://ke.qq.com/course/484107?tuin=ba64518

介绍主要的k8s资源的使用配置和命令。包括configmap,pod,service,replicaset,namespace,deployment,daemonset,ingress,pv,pvc,sc,role,rolebinding,clusterrole,clusterrolebinding,secret,serviceaccount,statefulset,job,cronjob,podDisruptionbudget,podSecurityPolicy,networkPolicy,resourceQuota,limitrange,endpoint,event,conponentstatus,node,apiservice,controllerRevision等。

第三个视频发布:https://edu.csdn.net/course/detail/27574

详细介绍helm命令,学习helm chart语法,编写helm chart。深入分析各项目源码,学习编写helm插件


————————————————

Logon消息结构:

 

ield or ComponentField NameFIXML nameReq'dCommentsDepr.
dummy.gifuploading.4e448015.gif转存失败重新上传取消ComponentStandardHeaderBaseHeadercheckmark.gifuploading.4e448015.gif转存失败重新上传取消

MsgType = A

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消98EncryptMethod checkmark.gifuploading.4e448015.gif转存失败重新上传取消

(Always unencrypted)

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消108HeartBtInt checkmark.gifuploading.4e448015.gif转存失败重新上传取消

Note same value used by both sides

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消95RawDataLength@RawDataLength 

Required for some authentication methods

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消96RawData@RawData 

Required for some authentication methods

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消141ResetSeqNumFlag  

Indicates both sides of a FIX session should reset sequence numbers

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消789NextExpectedMsgSeqNum  

Optional, alternative via counterparty bi-lateral agreement message gap detection and recovery approach (see "Logon Message NextExpectedMsgSeqNum Processing" section)

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消383MaxMessageSize  

Can be used to specify the maximum number of bytes supported for messages received

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消ComponentMsgTypeGrpMsgTypeGrp   
dummy.gifuploading.4e448015.gif转存失败重新上传取消464TestMessageIndicator  

Can be used to specify that this FIX session will be sending and receiving "test" vs. "production" messages.

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消553Username@Username   
dummy.gifuploading.4e448015.gif转存失败重新上传取消554Password@Password 

Note: minimal security exists without transport-level encryption.

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消925NewPassword@NewPassword 

Specifies a new password for the FIX Logon. The new password is used for subsequent logons.

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消1400EncryptedPasswordMethod@EncPwdMethod   
dummy.gifuploading.4e448015.gif转存失败重新上传取消1401EncryptedPasswordLen    
dummy.gifuploading.4e448015.gif转存失败重新上传取消1402EncryptedPassword@EncPwd   
dummy.gifuploading.4e448015.gif转存失败重新上传取消1403EncryptedNewPasswordLen    
dummy.gifuploading.4e448015.gif转存失败重新上传取消1404EncryptedNewPassword@EncNewPwd 

Encrypted new password- encrypted via the method specified in the field EncryptedPasswordMethod(1400)

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消1409SessionStatus@SessStat 

Session status at time of logon. Field is intended to be used when the logon is sent as an acknowledgement from acceptor of the FIX session.

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消1137DefaultApplVerID@DefApplVerIDcheckmark.gifuploading.4e448015.gif转存失败重新上传取消

The default version of FIX messages used in this session.

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消1407DefaultApplExtID@DfltApplExtID 

The default extension pack for FIX messages used in this session

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消1408DefaultCstmApplVerID  

The default custom application version (dictionary) for FIX messages used in this session

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消58Text@Txt 

Available to provide a response to logon when used as a logon acknowledgement from acceptor back to the logon initiator.

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消354EncodedTextLen@EncTxtLen 

Must be set if EncodedText field is specified and must immediately precede it.

 
dummy.gifuploading.4e448015.gif转存失败重新上传取消355EncodedText@EncTxt 

Encoded (non-ASCII characters) representation of the Text field in the encoded format specified via the MessageEncoding field.

 

 

dummy.gifuploading.4e448015.gif转存失败重新上传取消ComponentStandardTrailer checkmark.gifuploading.4e448015.gif转存失败重新上传取消

 

Logon消息故名思议就是登入用的消息.

MsgType=A(35=A);

一个封装的例子:

 

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-10-25
 */
public class LogonMsg extends BaseMsg {
	private Tag encryptMethod=new Tag("98","int",true);
	private Tag heartBtInt=new Tag("108","int",true);
	private Tag rawDataLength=new Tag("95","Length",false);
	private Tag rawData=new Tag("96","data",false);
	private Tag resetSeqNumFlag=new Tag("141","Boolean",false);
	private Tag nextExpectedMsgSeqNum=new Tag("789","SeqNum",true);
	private Tag maxMessageSize=new Tag("383","Length",false);
	private Tag msgTypeGrpTag=new MsgTypeGrpTag();
	private Tag testMessageIndicator=new Tag("464","Boolean",false);
	private Tag username=new Tag("553","String",false);
	private Tag password=new Tag("554","String",false);
	private Tag defaultApplVerID=new Tag("1137","String",true);
	private Tag text=new Tag("58","String",false);
	private Tag newPassword=new Tag("529","String",false);
	private Tag encryptedPasswordMethod=new Tag("1400","int",false);
	private Tag encryptedPasswordLen=new Tag("1401","Length",false);
	private Tag encryptedPassword=new Tag("1402","data",false);
	private Tag encryptedNewPasswordLen=new Tag("1403","Length",false);
	private Tag encryptedNewPassword=new Tag("1404","data",false);
	private Tag SessionStatus=new Tag("1409","int",false);
	private Tag defaultApplExtID=new Tag("1407","int",false);
	private Tag defaultCstmApplVerID=new Tag("1408","String",false);
	private Tag encodedTextLen=new Tag("354","Length",false);
	private Tag encodedText=new Tag("355","data",false);
	
	public LogonMsg(){
		this.getHeadEntity().getMsgType().setTagValue("A");
		tagIdsSet.add("98");
		tagIdsSet.add("108");
		tagIdsSet.add("95");
		tagIdsSet.add("96");
		tagIdsSet.add("141");
		tagIdsSet.add("789");
		tagIdsSet.add("383");
		tagIdsSet.add("464");
		tagIdsSet.add("553");
		tagIdsSet.add("554");
		tagIdsSet.add("1137");
		tagIdsSet.add("372");
		tagIdsSet.add("385");
		tagIdsSet.add("1130");
		tagIdsSet.add("1131");
		tagIdsSet.add("384");
		tagIdsSet.add("58");
		tagIdsSet.add("529");
		tagIdsSet.add("1400");
		tagIdsSet.add("1401");
		tagIdsSet.add("1402");
		tagIdsSet.add("1403");
		tagIdsSet.add("1404");
		tagIdsSet.add("1409");
		tagIdsSet.add("1407");
		tagIdsSet.add("1408");
		tagIdsSet.add("354");
		tagIdsSet.add("355");
		this.bodyEntity.getBodyTagList().add(encryptMethod);
		this.bodyEntity.getBodyTagList().add(heartBtInt);
		this.bodyEntity.getBodyTagList().add(rawDataLength);
		this.bodyEntity.getBodyTagList().add(rawData);
		this.bodyEntity.getBodyTagList().add(resetSeqNumFlag);
		this.bodyEntity.getBodyTagList().add(nextExpectedMsgSeqNum);
		this.bodyEntity.getBodyTagList().add(maxMessageSize);
		this.bodyEntity.getBodyTagList().add(msgTypeGrpTag);
		this.bodyEntity.getBodyTagList().add(testMessageIndicator);
		this.bodyEntity.getBodyTagList().add(username);
		this.bodyEntity.getBodyTagList().add(password);
		this.bodyEntity.getBodyTagList().add(defaultApplVerID);
		this.bodyEntity.getBodyTagList().add(text);
		this.bodyEntity.getBodyTagList().add(newPassword);
		this.bodyEntity.getBodyTagList().add(encryptedPasswordMethod);
		this.bodyEntity.getBodyTagList().add(encryptedPasswordLen);
		this.bodyEntity.getBodyTagList().add(encryptedPassword);
		this.bodyEntity.getBodyTagList().add(encryptedNewPasswordLen);
		this.bodyEntity.getBodyTagList().add(encryptedNewPassword);
		this.bodyEntity.getBodyTagList().add(SessionStatus);
		this.bodyEntity.getBodyTagList().add(defaultApplExtID);
		this.bodyEntity.getBodyTagList().add(defaultCstmApplVerID);
		this.bodyEntity.getBodyTagList().add(encodedTextLen);
		this.bodyEntity.getBodyTagList().add(encodedText);
	}
	
	private Set<String> tagIdsSet=new HashSet<String>();
	
	@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();
		int encryptMethodType= Integer.parseInt(encryptMethod.getTagValue());
		if(encryptMethodType<0||encryptMethodType>6){
			throw new InValidDataException("encryptMethod错误");
		}
		if(!MsgUtil.applVerID.contains(defaultApplVerID.getTagValue())){
			throw new InValidDataException("defaultApplVerID错误");
		}
		if(SessionStatus.getTagValue()!=null){
			if(!MsgUtil.sessionStatus.contains(SessionStatus.getTagValue())){
				throw new InValidDataException("sessionStatus错误");
			}
		}
		

	}

	public Tag getEncryptMethod() {
		return encryptMethod;
	}

	public void setEncryptMethod(Tag encryptMethod) {
		this.encryptMethod = encryptMethod;
	}

	public Tag getHeartBtInt() {
		return heartBtInt;
	}

	public void setHeartBtInt(Tag heartBtInt) {
		this.heartBtInt = heartBtInt;
	}

	public Tag getRawDataLength() {
		return rawDataLength;
	}

	public void setRawDataLength(Tag rawDataLength) {
		this.rawDataLength = rawDataLength;
	}

	public Tag getRawData() {
		return rawData;
	}

	public void setRawData(Tag rawData) {
		this.rawData = rawData;
	}

	public Tag getResetSeqNumFlag() {
		return resetSeqNumFlag;
	}

	public void setResetSeqNumFlag(Tag resetSeqNumFlag) {
		this.resetSeqNumFlag = resetSeqNumFlag;
	}

	public Tag getNextExpectedMsgSeqNum() {
		return nextExpectedMsgSeqNum;
	}

	public void setNextExpectedMsgSeqNum(Tag nextExpectedMsgSeqNum) {
		this.nextExpectedMsgSeqNum = nextExpectedMsgSeqNum;
	}

	public Tag getMaxMessageSize() {
		return maxMessageSize;
	}

	public void setMaxMessageSize(Tag maxMessageSize) {
		this.maxMessageSize = maxMessageSize;
	}

	public Tag getMsgTypeGrpTag() {
		return msgTypeGrpTag;
	}

	public void setMsgTypeGrpTag(Tag msgTypeGrpTag) {
		this.msgTypeGrpTag = msgTypeGrpTag;
	}

	public Tag getTestMessageIndicator() {
		return testMessageIndicator;
	}

	public void setTestMessageIndicator(Tag testMessageIndicator) {
		this.testMessageIndicator = testMessageIndicator;
	}

	public Tag getUsername() {
		return username;
	}

	public void setUsername(Tag username) {
		this.username = username;
	}

	public Tag getPassword() {
		return password;
	}

	public void setPassword(Tag password) {
		this.password = password;
	}

	public Tag getDefaultApplVerID() {
		return defaultApplVerID;
	}

	public void setDefaultApplVerID(Tag defaultApplVerID) {
		this.defaultApplVerID = defaultApplVerID;
	}

	@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)){
				if(tagId.equals("384")){
					int skip=decodeGroup384(this.body);
					i=i+skip-1;
				}else{
					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+"不在消息体内");
			}
		}
		
	}
	
	private int decodeGroup384(String body){
		int index=body.indexOf("384=");
		String rest=body.substring(index);
		String[]tagItems=rest.split(BaseMsg.SOH);
		String[] numTagItems=tagItems[0].split("=");
		if(numTagItems.length!=2){
			throw new InValidDataException("消息格式错误");
		}
		if(!"384".equals(numTagItems[0])){
			throw new InValidDataException("消息格式错误");
		}
		int num=Integer.parseInt(numTagItems[1]);
		int count=1;
		int whileCount=0;
		((MsgTypeGrpTag)this.msgTypeGrpTag).setTagValue(num+"");
		boolean end=false;
		for(int i=0;i<num;i++){
			if(end){
				if(i!=num){
					throw new InValidDataException("消息格式错误");
				}else{
					break;
				}
			}
			MsgTypeGrp msgTypeGrp=new MsgTypeGrp();
			((MsgTypeGrpTag)this.msgTypeGrpTag).getChildren().add(msgTypeGrp);
			while(true){
				if(whileCount>=4){
					whileCount=0;
					break;
				}
				String[] tagIt=tagItems[count].split("=");
				if(tagIt.length!=2){
					throw new InValidDataException("消息格式错误");
				}
				if(whileCount==0){
					if(!MsgTypeGrpTag.first.equals(tagIt[0])){
						throw new InValidDataException("消息格式错误");
					}
				}
				
				if(MsgTypeGrp.tagIdsSet.contains(tagIt[0])){
					List<Tag> tagList=msgTypeGrp.getTagList();
					for(int j=0;j<tagList.size();j++){
						Tag groupTag=tagList.get(j);
						if(groupTag.getTagId().equals(tagIt[0])){
							groupTag.setTagValue(tagIt[1]);
							break;
						} 
					}
					if(tagItems.length>count+1){
						String[] nextTagIt=tagItems[count+1].split("=");
						if(nextTagIt.length!=2){
							throw new InValidDataException("消息格式错误");
						}
						if(MsgTypeGrpTag.first.equals(nextTagIt[0])){
							whileCount=0;
							count++;
							break;
						}
					}
					
					count++;
					whileCount++;
					
				}else{
					end=true;
					break;
				}
				
			}
			
		}
		
		return count;
	}

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

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

	public Tag getText() {
		return text;
	}

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

	public Tag getNewPassword() {
		return newPassword;
	}

	public void setNewPassword(Tag newPassword) {
		this.newPassword = newPassword;
	}

	public Tag getEncryptedPasswordMethod() {
		return encryptedPasswordMethod;
	}

	public void setEncryptedPasswordMethod(Tag encryptedPasswordMethod) {
		this.encryptedPasswordMethod = encryptedPasswordMethod;
	}

	public Tag getEncryptedPasswordLen() {
		return encryptedPasswordLen;
	}

	public void setEncryptedPasswordLen(Tag encryptedPasswordLen) {
		this.encryptedPasswordLen = encryptedPasswordLen;
	}

	public Tag getEncryptedPassword() {
		return encryptedPassword;
	}

	public void setEncryptedPassword(Tag encryptedPassword) {
		this.encryptedPassword = encryptedPassword;
	}

	public Tag getEncryptedNewPasswordLen() {
		return encryptedNewPasswordLen;
	}

	public void setEncryptedNewPasswordLen(Tag encryptedNewPasswordLen) {
		this.encryptedNewPasswordLen = encryptedNewPasswordLen;
	}

	public Tag getEncryptedNewPassword() {
		return encryptedNewPassword;
	}

	public void setEncryptedNewPassword(Tag encryptedNewPassword) {
		this.encryptedNewPassword = encryptedNewPassword;
	}

	public Tag getSessionStatus() {
		return SessionStatus;
	}

	public void setSessionStatus(Tag sessionStatus) {
		SessionStatus = sessionStatus;
	}

	public Tag getDefaultApplExtID() {
		return defaultApplExtID;
	}

	public void setDefaultApplExtID(Tag defaultApplExtID) {
		this.defaultApplExtID = defaultApplExtID;
	}

	public Tag getDefaultCstmApplVerID() {
		return defaultCstmApplVerID;
	}

	public void setDefaultCstmApplVerID(Tag defaultCstmApplVerID) {
		this.defaultCstmApplVerID = defaultCstmApplVerID;
	}

	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;
	}

}


数据例子:

 

 

输入:
8=FIXT.1.1_9=86_35=A_49=CO99999901_56=HKEXCO_34=100_52=20131126-16:44:17.542_98=0_108=5_789=11_1137=9_10=028_

输出:
8=FIXT.1.1_9=117_35=A_49=HKEXCO_56=CO99999901_34=13_52=20131126-08:45:59.135_1128=9_58=Session Active_98=0_108=20_789=1_1137=9_1409=0_10=166_8=FIXT.1.1_9=110_35=4_49=HKEXCO_56=CO99999901_34=11_52=20131126-08:45:59.135_1128=9_43=Y_122=20131126-08:45:59.135_36=14_123=Y_10=024_


特别字段说明:

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hxpjava1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值