예제 #1
0
        public MarketIncrementalProcessor(ChannelUMDFState state, ChannelUMDFConfig config, MonitorConfig monitorConfig) :
            base(config.MDIncrementalHost, config.MDIncrementalPorta, config.TemplateFile, config.ChannelID, config.LocalInterfaceAddress)
        {
            this.channelConfig = config;
            this.channelState  = state;
            this.processorType = ProcessorType.MarketIncremental;
            this.monitorConfig = monitorConfig;

            ProcessamentoMensagensEnabled    = false;
            ProcessamentoMensagensLockObject = new object();
            ReplayLockObject = new object();

            logger = LogManager.GetLogger("MarketIncrementalProcessor-" + config.ChannelID);

            MDSUtils.AddAppender("MarketIncrementalProcessor-" + config.ChannelID, logger.Logger);

            //if (int.Parse(channelConfig.ChannelID) <= 10)
            //    tcpReplayBMF = TCPReplayBMF.GetInstance(this, channelConfig, config.TemplateFile, qUdpPkt, ReplayLockObject);
            //else
            //    tcpReplayBovespa = new TCPReplayBovespa(this, channelConfig, config.TemplateFile, qUdpPkt, ReplayLockObject);

            //if (channelConfig.IsPuma)
            //    tcpReplayBMF = TCPReplayBMF.GetInstance(this, channelConfig, config.TemplateFile, qUdpPktReplay, ReplayLockObject);
            //else
            //    tcpReplayBovespa = new TCPReplayBovespa(this, channelConfig, config.TemplateFile, qUdpPktReplay, ReplayLockObject);

            fixInitiator = new FixInitiator(this, channelConfig, config.TemplateFile, qUdpPktReplay, ReplayLockObject);
        }
예제 #2
0
        public virtual void Stop()
        {
            bKeepRunning = false;
            try
            {
                if (clientSocketPRI != null)
                {
                    logger.Info("*** Fechando Conexao UDP");
                    clientSocketPRI.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.DropMembership, mcoPRI);
                    clientSocketPRI.Close();
                    clientSocketPRI.Dispose();
                }

                if (clientSocketSEC != null)
                {
                    logger.Info("*** Fechando Conexao UDP Secundaria");
                    clientSocketSEC.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.DropMembership, mcoSEC);
                    clientSocketSEC.Close();
                    clientSocketSEC.Dispose();
                }

                if (fixInitiator != null)
                {
                    fixInitiator.Stop();
                    fixInitiator = null;
                    logger.Info("*** Fechando Conexao FixInitiator");
                }
            }
            catch (ObjectDisposedException)
            { }
            catch (Exception ex)
            {
                logger.Error("Stop(): " + ex.Message, ex);
            }
        }