예제 #1
0
 public void Setup()
 {
     this.distributorServiceTestFacade = new DistributorServiceTestFacade();
     this.listener = new MsmqListener(this.distributorServiceTestFacade, 1000);
     this.eventLogger = distributorServiceTestFacade.EventLogger;
     this.mockQ = new MockMsmqLogDistributor(Context);
 }
예제 #2
0
        /// <summary>
        /// Initialize a new instance of the <see cref="MsmqListener"/>.
        /// </summary>
        /// <param name="distributorService">Distributor service inheriting from <see cref="System.ServiceProcess.ServiceBase"/>.</param>
        /// <param name="timerInterval">Interval to check for new messages.</param>
        public MsmqListener(DistributorService distributorService, int timerInterval)
        {
            this.distributorService = distributorService;
            this.QueueTimerInterval = timerInterval;
            this.eventLogger = distributorService.EventLogger;

            this.logDistributor = new MsmqLogDistributor(ConfigurationManager.GetCurrentContext(), this.eventLogger);
        }
예제 #3
0
 public DistributorEvents()
 {
     logger = new DistributorEventLogger();
 }
예제 #4
0
 public DistributorEvents()
 {
     logger = new DistributorEventLogger();
 }
예제 #5
0
 /// <summary>
 /// Set up the queue with the specified logger
 /// </summary>
 /// <param name="configurationContext"><see cref="ConfigurationContext"></see> containing current configuration information</param>
 /// <param name="eventLogger"><see cref="DistributorEventLogger"></see> to use for distributing events from this object</param>
 public MsmqLogDistributor(ConfigurationContext configurationContext, DistributorEventLogger eventLogger)
     : base(configurationContext)
 {
     this.eventLogger = eventLogger;
 }
예제 #6
0
        /// <summary/>
        /// <exclude/>
        /// <devdoc>
        /// Initialization of the service.  Start the queue listener and write status to event log.
        /// </devdoc>
        public void InitializeComponent()
        {
            try
            {
                // Use the default settings for log name and application name.
                // This is done to ensure the windows service starts correctly.
                this.ApplicationName = DefaultApplicationName;

                this.eventLogger = new DistributorEventLogger();
                this.eventLogger.AddMessage(SR.InitializeComponentStartedMessage, SR.InitializeComponentStarted);
                this.status = ServiceStatus.OK;

                DistributorSettings distributorSettings = (DistributorSettings)ConfigurationManager.GetConfiguration(DistributorSettings.SectionName);

                this.queueListener = new MsmqListener(this, distributorSettings.DistributorService.QueueTimerInterval);

                //this.ApplicationName = this.ServiceName;
                this.ApplicationName = distributorSettings.DistributorService.ServiceName;
                this.eventLogger.AddMessage("name", this.ApplicationName);

                this.eventLogger.ApplicationName = this.ApplicationName;
                this.eventLogger.AddMessage(SR.InitializeComponentCompletedMessage, SR.InitializeComponentCompleted);
            }
            catch (LoggingException loggingException)
            {
                this.eventLogger.AddMessage(Header, SR.ServiceStartError(this.ApplicationName));

                this.eventLogger.WriteToLog(loggingException, Severity.Error);
                throw;
            }
            catch (Exception ex)
            {
                this.eventLogger.AddMessage(Header, SR.ServiceStartError(this.ApplicationName));

                this.eventLogger.WriteToLog(ex, Severity.Error);
                throw new LoggingException(SR.ErrorInitializingService, ex);
            }
            catch
            {
                throw new LoggingException(SR.ErrorInitializingService);
            }
        }
예제 #7
0
        public void Setup()
        {
            this.distributorServiceTestFacade = new DistributorServiceTestFacade();
            this.eventLogger = distributorServiceTestFacade.EventLogger;
            this.mockListener = new MockMsmqListener(this.distributorServiceTestFacade, 1000);

            this.distributorServiceTestFacade.QueueListener = mockListener;

            CommonUtil.SetDistributionStrategy("Msmq");
        }
예제 #8
0
 public SanityCheck(DistributorService distributorService)
 {
     this.eventLogger = distributorService.EventLogger;
     this.distributorService = distributorService;
 }