Ejemplo n.º 1
0
        protected override void OnStart(string[] args)
        {
            // log
            ErrorLogger.Log(ErrorLogger.LogType.OUTBOUND_SERVICE_STARTING, DateTime.Now.ToString());

            // get all configuration data
            List <Configuration> configs = ConfigurationDAO.GetApplications();

            // get the master configuration
            Configuration masterConfig = ConfigurationDAO.GetAllConfigurations();

            // gets the outgoing webservice configuration only
            List <Configuration> applications = ConfigurationUtility.GetIncomingWebservice(configs);

            applications.ForEach(delegate(Configuration appConfig) {
                OutboundHandler outboundHandler = new OutboundHandler();
                string appName = appConfig.application.name;

                // set the app name
                outboundHandler.setApplicationName(appName);

                // set the master config
                outboundHandler.setMasterConfiguration(masterConfig);

                // set the static worker
                outboundHandler.setProcessingWorker(OutboundHandlerDAO.handleProcessingForOutboundHandler);

                // add to queue and run
                ThreadPool.QueueUserWorkItem(new WaitCallback(startOutboundProcessing), outboundHandler);
            });
        }