示例#1
0
func NewTFunServer(engine *Engine,
	processor thrift.TProcessor,
	serverTransport thrift.TServerTransport,
	transportFactory thrift.TTransportFactory,
	protocolFactory thrift.TProtocolFactory) *TFunServer {
	return &TFunServer{
		engine:                 engine,
		processorFactory:       thrift.NewTProcessorFactory(processor),
		serverTransport:        serverTransport,
		inputTransportFactory:  transportFactory,
		outputTransportFactory: transportFactory,
		inputProtocolFactory:   protocolFactory,
		outputProtocolFactory:  protocolFactory,
	}
}
示例#2
0
// NewNATSServer returns a Thrift TServer which uses the NATS messaging system
// as the underlying transport. The subject is the NATS subject used for
// connection handshakes. The client timeout controls the read timeout on the
// client connection (negative value for no timeout). The heartbeat deadline
// controls how long clients have to respond with a heartbeat (negative value
// for no heartbeats).
func NewNATSServer(
	conn *nats.Conn,
	subject string,
	clientTimeout time.Duration,
	heartbeatDeadline time.Duration,
	processor thrift.TProcessor,
	transportFactory thrift.TTransportFactory,
	protocolFactory thrift.TProtocolFactory) thrift.TServer {

	return NewNATSServerFactory7(
		conn,
		subject,
		clientTimeout,
		heartbeatDeadline,
		thrift.NewTProcessorFactory(processor),
		transportFactory,
		protocolFactory,
	)
}