Example #1
0
    static void Main(string[] args)
    {
      //Start the background mock trade generator thread
      (new Thread(TradeEventGenerator.ThreadProc)).Start();

      //Create the Service Handler and Processor
      TradeStreamHandler handler = new TradeStreamHandler();
      PNWF.TradeStream.Processor proc = new PNWF.TradeStream.Processor(handler);

      //Setup the I/O stack factories
      TServerTransport trans = new TNamedPipeServerTransport("TradeStream");
      TTransportFactory transFac = new TTransportFactory();
      TProtocolFactory protoFac = new TCompactProtocol.Factory();

      //Setup the server and register the event handler
      TServer server = new TThreadedServer(proc, trans, transFac, protoFac);
      server.setEventHandler(new TradeServerEventHandler());
      server.Serve();
    }