Beispiel #1
0
 public OrderPublisherAddin()
 {
     nmsClient = NmsClientFactory.GetClientFor(Configuration.BrokerUrl);
     if (!nmsClient.Connected())
     {
         // Sleep to give the connection time to startup
         Thread.Sleep(500);
     }
 }
Beispiel #2
0
        public OrderPublisherAddin(AppConfiguration config)
        {
            _config = config;

            _nmsClient = NmsClientFactory.GetClientFor(_config.BrokerUrl);
            if (!_nmsClient.Connected())
            {
                // Sleep to give the connection time to startup
                Thread.Sleep(500);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Startup the RTD server to listen to the Broker.
        /// </summary>
        /// <param name="callbackObject"></param>
        /// <returns></returns>
        int IRtdServer.ServerStart(IRTDUpdateEvent callbackObject)
        {
            try {
                xlRTDUpdateCallbackHandler = callbackObject;
                nmsClient = NmsClientFactory.GetClientFor(Configuration.BrokerUrl);

                if (!nmsClient.Connected())
                {
                    nmsClient.Start();
                    // Sleep to give the connection time to startup
                    Thread.Sleep(500);
                }
                nmsClient.UpdatedOrder += ReceivedOrder;

                lastHeartbeat = 1;
                return(1);
            } catch (Exception e) {
                log.Error(e);
                return(-1);
            }
        }
Beispiel #4
0
//        static OrderSubscriberRtd() {
//            var configurationFileName = System.Reflection.Assembly.GetExecutingAssembly().Location + ".config";
//            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(configurationFileName));
//        }

        #region RTD
        /// <summary>
        /// Startup the RTD server to listen to the Broker.
        /// </summary>
        /// <param name="callbackObject"></param>
        /// <returns></returns>
        public int ServerStart(IRTDUpdateEvent callbackObject)
        {
            try {
                _xlRtdUpdateCallbackHandler = callbackObject;
                _nmsClient = NmsClientFactory.GetClientFor(_config.BrokerUrl);

                if (!_nmsClient.Connected())
                {
                    _nmsClient.Start();
                    // Sleep to give the connection time to startup
                    Thread.Sleep(500);
                }
                _nmsClient.UpdatedOrder += ReceivedOrder;

                _lastHeartbeat = 1;
                return(1);
            } catch (Exception e) {
                _log.Error(e);
                return(-1);
            }
        }