Example #1
0
func (s *Session) resend(msg *Message) {
	header := msg.Header.(fieldMap)
	header.Set(field.NewPossDupFlag(true))

	origSendingTime := new(fix.StringValue)
	if err := header.GetField(tag.SendingTime, origSendingTime); err == nil {
		header.Set(fix.NewStringField(tag.OrigSendingTime, origSendingTime.Value))
	}

	s.insertSendingTime(header)

	msg.rebuild()
	s.sendBytes(msg.rawMessage)
}
Example #2
0
func (state *inSession) generateSequenceReset(session *Session, beginSeqNo int, endSeqNo int) {
	sequenceReset := NewMessageBuilder()
	session.fillDefaultHeader(sequenceReset)

	sequenceReset.Header().Set(field.NewMsgType("4"))
	sequenceReset.Header().Set(field.NewMsgSeqNum(beginSeqNo))
	sequenceReset.Header().Set(field.NewPossDupFlag(true))
	sequenceReset.Body().Set(field.NewNewSeqNo(endSeqNo))
	sequenceReset.Body().Set(field.NewGapFillFlag(true))

	origSendingTime := new(fix.StringValue)
	if err := sequenceReset.Header().GetField(tag.SendingTime, origSendingTime); err == nil {
		sequenceReset.Header().Set(fix.NewStringField(tag.OrigSendingTime, origSendingTime.Value))
	}

	//FIXME error check?
	msgBytes, _ := sequenceReset.Build()
	session.sendBytes(msgBytes)
}