예제 #1
0
        //---------------------------------------------------
        //
        //  Agent Initialization
        //
        //---------------------------------------------------
        void Init(SmtpAgentSettings settings)
        {
            if (settings.FailedInit)
            {
                EventLogHelper.WriteError(
                    new LogFileSettings().EventLogSource,
                    "Failed Init!  Using a disabled SmtpAgentSettings.");

                m_settings = settings;
                var log = new NLogFactory(settings.LogSettings);
                m_logger = log.GetLogger(GetType());

                return;
            }

            m_settings = settings;
            m_settings.Validate();

            m_auditor = IoC.ResolveAll <IAuditor <IBuildAuditLogMessage> >().ToList();

            m_logger = Log.For(this);

            m_diagnostics    = new AgentDiagnostics(this);
            m_configService  = new ConfigService(m_settings);
            m_monitorService = new MonitorService(m_settings);

            using (new MethodTracer(Logger))
            {
                try
                {
                    //
                    // First, setup defaults using Xml Config
                    //
                    this.InitDomains();
                    this.InitFolders();
                    this.InitRoutes();
                    this.InitNotifications();
                    //
                    // Call config service, if any was configured
                    //
                    this.InitDomainsFromConfigService();
                    //
                    // Finally, we can agent...
                    //
                    this.InitAgent();
                    this.SubscribeToAgentEvents();
                    this.ConfigureServicePoints();
                }
                catch (Exception ex)
                {
                    Logger.Error("While initializing {0}", ex.ToString());
                    throw;
                }
            }
        }
예제 #2
0
        //---------------------------------------------------
        //
        //  Agent Initialization
        //
        //---------------------------------------------------
        void Init(SmtpAgentSettings settings)
        {
            m_settings = settings;
            m_settings.Validate();

            m_auditor = IoC.ResolveAll <IAuditor <IBuildAuditLogMessage> >().ToList();

            m_logger = Log.For(this);

            m_diagnostics    = new AgentDiagnostics(this);
            m_configService  = new ConfigService(m_settings);
            m_monitorService = new MonitorService(m_settings);

            using (new MethodTracer(Logger))
            {
                try
                {
                    //
                    // First, setup defaults using Xml Config
                    //
                    this.InitDomains();
                    this.InitFolders();
                    this.InitRoutes();
                    this.InitNotifications();
                    //
                    // Call config service, if any was configured
                    //
                    this.InitDomainsFromConfigService();
                    //
                    // Finally, we can agent...
                    //
                    this.InitAgent();
                    this.SubscribeToAgentEvents();
                    this.ConfigureServicePoints();
                }
                catch (Exception ex)
                {
                    Logger.Error("While initializing {0}", ex.ToString());
                    throw;
                }
            }
        }
예제 #3
0
파일: SmtpAgent.cs 프로젝트: DM-TOR/nhin-d
        //---------------------------------------------------
        //
        //  Agent Initialization
        //
        //---------------------------------------------------
        void Init(SmtpAgentSettings settings)
        {
            m_settings = settings;
            m_settings.Validate();

            m_auditor = IoC.ResolveAll<IAuditor<IBuildAuditLogMessage>>().ToList();
            
            m_logger = Log.For(this);

            m_diagnostics = new AgentDiagnostics(this);
            m_configService = new ConfigService(m_settings);
            m_monitorService = new MonitorService(m_settings);

            using (new MethodTracer(Logger))
            {
                try
                {
                    //
                    // First, setup defaults using Xml Config
                    //
                    this.InitDomains();
                    this.InitFolders();
                    this.InitRoutes();
                    this.InitNotifications();
                    //
                    // Call config service, if any was configured
                    //
                    this.InitDomainsFromConfigService();
                    //
                    // Finally, we can agent...
                    //
                    this.InitAgent();
                    this.SubscribeToAgentEvents();
                    this.ConfigureServicePoints();
                }
                catch (Exception ex)
                {
                    Logger.Error("While initializing {0}", ex.ToString());
                    throw;
                }
            }
        }