Service Multiplexing using Apache Thrift

后端 未结 1 1116
故里飘歌
故里飘歌 2021-01-14 01:14

Server code:

            TMultiplexedProcessor processor = new TMultiplexedProcessor();

            processor.registerProcessor(
                \"AddServic         


        
1条回答
  •  离开以前
    2021-01-14 01:41

    Not tested, but it looks very much like as if you run two different protocol stacks on server and client. Try this:

    TMultiplexedProcessor processor = new TMultiplexedProcessor();
    
    processor.registerProcessor(
        "AddService",
        new AddService.Processor(new AddHandler()));
    
    processor.registerProcessor(
        "MultiplyService",
        new MultiplyService.Processor(new MultiplyHandler()));
    
    TServerTransport serverTransport = new TServerSocket(7911);
    
    TTransportFactory factory = new TFramedTransport.Factory();
    
    TServer.Args args = new TServer.Args(serverTransport);
    args.processor(processor);
    args.transportFactory(factory);
    TSimpleServer server = new TSimpleServer(args);
    
    System.out.println("Starting server on port 7911 ...");
    server.serve();
    

    0 讨论(0)
提交回复
热议问题