Exemplo n.º 1
0
        public void ServerTerminate()
        {
            WriteLog(string.Format("ServerTerminate()"));

            try
            {
                priceClient.UnSubscribe("ST.OMS.SERVER.Price.>");
                priceClient = null;

                msgChannel.DisConnect();
                msgChannel.Destory();

                #region
                RTDServerConfig.Instance.ServiceCode = msgChannel.Service;
                RTDServerConfig.Instance.Network = msgChannel.Network;
                RTDServerConfig.Instance.Daemon = msgChannel.Daemon;
                #endregion
            }
            catch (Exception exp)
            {
                WriteLog("MsgChannel disconnect failed");
            }
        }
Exemplo n.º 2
0
        public int ServerStart(IRTDUpdateEvent callback)
        {
            WriteLog("ServerStart() ");

            try
            {
                msgChannel = new TibcoMsgChannel();
                msgChannel.Service = RTDServerConfig.Instance.ServiceCode;
                msgChannel.Network = RTDServerConfig.Instance.Network;
                msgChannel.Daemon = RTDServerConfig.Instance.Daemon;
                msgChannel.Description = "PriceRTDServer";
                msgChannel.Connect();

                priceClient = new PriceClient(msgChannel);
                priceClient.OnUpdatePrice += new Action<string, decimal>(priceClient_OnUpdatePrice);
                priceClient.Subscribe("ST.OMS.SERVER.Price.>");

                WriteLog(string.Format("MsgChannel {0},{1},{2}", RTDServerConfig.Instance.Daemon, RTDServerConfig.Instance.Network, RTDServerConfig.Instance.ServiceCode));
            }
            catch (Exception exp)
            {
                WriteLog("MsgChannel connect faile");
            }

            m_callback = callback;
            return 1;
        }