/// <summary> /// Initializes the pool with default settings and binds to the active /// Logger output. /// </summary> /// <param name="runtimeConfiguration">Active configuration settings for the current session.</param> public WorkerRegistrationPool(RuntimeConfiguration runtimeConfiguration) { this.runtimeConfiguration = runtimeConfiguration; registrationPool = new List <WorkerRegistration>(); hostAddress = runtimeConfiguration.GetManagerBindAddress(); basePort = runtimeConfiguration.GetManagerComPort() + 1; }
public ApiMessageProcessor(RuntimeConfiguration runtimeConfiguration, WorkerRegistrationPool workerRegistrationPool, JobDispatchManager jobDispatchManager) { sharedLogger = runtimeConfiguration.GetLoggerInstance(); apiServer = new TCPServer(runtimeConfiguration.GetManagerBindAddress(), runtimeConfiguration.GetManagerExecPort()); workerPool = workerRegistrationPool; this.jobDispatchManager = jobDispatchManager; reportProcessor = new ReportProcessor(workerRegistrationPool, jobDispatchManager); activeClients = new List <TCPClient>(); commandProcessor = new CommandProcessor(jobDispatchManager); }
/// <summary> ///Initializes the manager with specified settings. /// </summary> /// <param name="runtimeConfiguration">Active runtime configuration settings for this session.</param> /// <param name="workerRegistrationPool">Configured pool of workers to manage.</param> /// <exception cref="ArgumentException">When invalid IP/port bindings are configured.</exception> public WorkerRegistrationManager(RuntimeConfiguration runtimeConfiguration, WorkerRegistrationPool workerRegistrationPool) { managerBindIP = runtimeConfiguration.GetManagerBindAddress(); try { tcpServer = new TCPServer(managerBindIP, runtimeConfiguration.GetManagerComPort()); } catch (ArgumentException e) { throw new ArgumentException("Invalid IP or port setting for the Worker Registration Manager. Check settings and try again.", e); } catch (IOException e) { throw new IOException("The Worker Registration Service encountered an error while binding to the configured IP/port configuration. Ensure that you have the correct permissions to use the port and that the requested port is not already in use by another process.", e); } shouldListen = false; registrationPool = workerRegistrationPool; sharedLogger = runtimeConfiguration.GetLoggerInstance(); this.runtimeConfiguration = runtimeConfiguration; }
/// <summary> /// Sets up all requisite services and starts listening for requests from workers, API clients, and internal dispatches. /// </summary> /// <param name="runtimeConfiguration">Active runtime configuration settings profile.</param> public override void Setup(RuntimeConfiguration runtimeConfiguration) { // TODO: Some of this can be moved up to the class initializer. workerRegistrationPool = new WorkerRegistrationPool(runtimeConfiguration); jobDispatchManager = new JobDispatchManager(runtimeConfiguration, workerRegistrationPool); apiMessageProcessor = new ApiMessageProcessor(runtimeConfiguration, workerRegistrationPool, jobDispatchManager); workerRegistrationManager = new WorkerRegistrationManager(runtimeConfiguration, workerRegistrationPool); dataStoreManager = new DataStoreManager(); workerMessageProcessor = new WorkerMessageProcessor(runtimeConfiguration, workerRegistrationPool, dataStoreManager); Task.Run(() => workerRegistrationManager.ListenAsync()); Task.Run(() => apiMessageProcessor.ListenAsync()); SharedLogger.Msg("Manager", "API", $"Manager is listening for registrations at {runtimeConfiguration.GetManagerBindAddress().ToString()}:{runtimeConfiguration.GetManagerComPort()}"); }
public override void Setup(RuntimeConfiguration runtimeConfiguration) { base.Setup(runtimeConfiguration); registerWorker(runtimeConfiguration.GetManagerBindAddress(), runtimeConfiguration.GetManagerComPort()); }