func NATSTransportFactory(conn *nats.Conn, subject string,
	timeout, readTimeout time.Duration) (thrift.TTransport, error) {

	msg, inbox, err := connect(conn, subject, timeout)
	if err != nil {
		return nil, err
	}
	if msg.Reply == "" {
		return nil, errors.New("thrift_nats: no reply subject on connect")
	}

	heartbeatAndDeadline := strings.Split(string(msg.Data), " ")
	if len(heartbeatAndDeadline) != 2 {
		return nil, errors.New("thrift_nats: invalid connect message")
	}
	heartbeat := heartbeatAndDeadline[0]
	deadline, err := strconv.ParseInt(heartbeatAndDeadline[1], 10, 64)
	var interval time.Duration
	if deadline > 0 {
		deadline = deadline - (deadline / 4)
		interval = time.Millisecond * time.Duration(deadline)
	}

	return NewNATSTransport(conn, inbox, msg.Reply, heartbeat, readTimeout, interval), nil
}
// NATSTransportFactory returns a new thrift TTransport which uses the NATS
// messaging system as the underlying transport. This TTransport can only be
// used with NATSServer.
NATSTransportFactory returns a new thrift TTransport which uses the NATS
messaging system as the underlying transport. This TTransport can only be
used with NATSServer.
// NATSTransportFactory returns a new thrift TTransport which uses the NATS // messaging system as the underlying transport . This TTransport can only be // used with NATSServer .
func NATSTransportFactory(conn *nats.Conn, subject string,
	timeout, readTimeout time.Duration) (thrift.TTransport, error) {
	msg, inbox, err := connect(conn, subject, timeout)
	if err != nil {
		return nil, err
	}
	if msg.Reply == "" {
		return nil, errors.New("thrift_nats: no reply subject on connect")
	}
	heartbeatAndDeadline := strings.Split(string(msg.Data), " ")
	if len(heartbeatAndDeadline) != 2 {
		return nil, errors.New("thrift_nats: invalid connect message")
	}
	heartbeat := heartbeatAndDeadline[0]
	deadline, err := strconv.ParseInt(heartbeatAndDeadline[1], 10, 64)
	var interval time.Duration
	if deadline > 0 {
		deadline = deadline - (deadline / 4)
		interval = time.Millisecond * time.Duration(deadline)
	}
	return NewNATSTransport(conn, inbox, msg.Reply, heartbeat, readTimeout, interval), nil
}
func NATSTransportFactory ( conn * nats . Conn , subject string , timeout , readTimeout time . Duration ) ( thrift . TTransport , error ) { msg , inbox , err := connect ( conn , subject , timeout ) if err != nil { return nil , err } if msg . Reply == " " { return nil , errors . New ( " " ) } heartbeatAndDeadline := strings . Split ( string ( msg . Data ) , " " ) if len ( heartbeatAndDeadline ) != 2 { return nil , errors . New ( " " ) } heartbeat := heartbeatAndDeadline [ 0 ] deadline , err := strconv . ParseInt ( heartbeatAndDeadline [ 1 ] , 10 , 64 ) var interval time . Duration if deadline > 0 { deadline = deadline - ( deadline / 4 ) interval = time . Millisecond * time . Duration ( deadline ) } return NewNATSTransport ( conn , inbox , msg . Reply , heartbeat , readTimeout , interval ) , nil }
NATSTransportFactory returns a new thrift TTransport which uses the NATS
messaging system as the underlying transport.
NATSTransportFactory returns a new thrift TTransport which uses the NATS messaging system as the underlying transport .