Example #1
0
        public override Envelope Prepare()
        {
            var mes = MessageFactory.GetMessage <StockHistoryRequestMessage>(Config.GetClientProcessNumber(), 0);

            mes.ConversationID = Conversation.Id;

            var stockServerIp   = Config.GetString(Config.STOCK_SERVER_IP);
            var stockSerevrPort = Config.GetInt(Config.STOCK_SERVER_TCP_PORT);
            var stockServer     = new IPEndPoint(IPAddress.Parse(stockServerIp), stockSerevrPort);

            ComService.AddTcpClient(0, stockServer);

            var env = new TcpEnvelope(mes, stockServerIp, stockSerevrPort);

            return(env);
        }
        public override Envelope Prepare()
        {
            Log.Debug($"{nameof(Prepare)} (enter)");

            Envelope env = null;

            //Build request message
            var processNum = Config.GetInt(Config.BROKER_PROCESS_NUM);
            var message    = MessageFactory.GetMessage <StockHistoryRequestMessage>(processNum, 0);

            message.ConversationID = Conversation.Id;
            var stockServerIp   = Config.GetString(Config.STOCK_SERVER_IP);
            var stockSerevrPort = Config.GetInt(Config.STOCK_SERVER_TCP_PORT);

            var address = new IPEndPoint(IPAddress.Parse(stockServerIp), stockSerevrPort);

            ComService.AddTcpClient(0, address);

            env = new TcpEnvelope(message, Config.GetString(Config.STOCK_SERVER_IP), Config.GetInt(Config.STOCK_SERVER_TCP_PORT));

            Log.Debug($"{nameof(Prepare)} (exit)");
            return(env);
        }