コード例 #1
0
        private void CreateAndStartServers()
        {
            RealTimeServer          = new RealTimeDataServer(Settings.Default.RealTimeDataServerRequestPort, RealTimeBroker);
            DataServer              = new HistoricalDataServer(Settings.Default.HistoricalServerPort, HistoricalBroker);
            MessagesServer          = new MessagesServer(Settings.Default.MessagesServerPushPort);
            EquityUpdateServer      = new EquityUpdateServer(Settings.Default.EquityUpdateServerRouterPort);
            InstrumentRequestServer = new RequestResponseServer(Settings.Default.InstrumetnUpdateRequestSocketPort);

            RealTimeServer.StartServer();
            DataServer.StartServer();
            MessagesServer.StartServer();
            InstrumentRequestServer.StartServer();
            //not using poller.Async, need to spawn thread
            Task.Factory.StartNew(EquityUpdateServer.StartServer, TaskCreationOptions.LongRunning);
        }
コード例 #2
0
        /// <summary>
        /// Starts the server.
        /// </summary>
        /// <param name="server">The server.</param>
        /// <returns><c>true</c> if Server is successfully started, <c>false</c> otherwise.</returns>
        /// <exception cref="System.ArgumentNullException">server</exception>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public bool StartServer(MqServer server)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            INetMQServer netMqServer;

            switch (server.ServerType)
            {
            case ServerType.EquityUpdate:
                netMqServer = new EquityUpdateServer(server);
                netMqServer.StartServer();
                break;

            case ServerType.HistoricalData:
                netMqServer = new HistoricalDataServer(server, null);
                netMqServer.StartServer();
                break;

            case ServerType.InstrumentRequest:
                netMqServer = new RequestResponseServer(server);
                netMqServer.StartServer();
                break;

            case ServerType.Message:
                netMqServer = new MessagesServer(server);
                netMqServer.StartServer();
                break;

            case ServerType.RealTimeData:
                netMqServer = new EquityUpdateServer(server);
                netMqServer.StartServer();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(netMqServer.ServerRunning);
        }