public static void Main() { var configurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; XmlConfigurator.ConfigureAndWatch(new FileInfo(configurationFile)); SetConsoleCtrlHandler(ConsoleCtrlCheck, true); AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var nodeConfig = new NodeConfiguration( new Uri(ConfigurationManager.AppSettings["ManagerLocation"]), Assembly.Load(ConfigurationManager.AppSettings["HandlerAssembly"]), int.Parse(ConfigurationManager.AppSettings["Port"]), ConfigurationManager.AppSettings["NodeName"], int.Parse(ConfigurationManager.AppSettings["PingToManagerSeconds"]) ); WhoAmI = "[NODE CONSOLE HOST ( " + nodeConfig.NodeName + ", " + nodeConfig.BaseAddress + " ), " + Environment.MachineName.ToUpper() + "]"; Logger.InfoWithLineNumber(WhoAmI + " : started."); var builder = new ContainerBuilder(); builder.RegisterModule(new WorkerModule()); Container = builder.Build(); NodeStarter = new NodeStarter(); NodeStarter.Start(nodeConfig, Container); QuitEvent.WaitOne(); }
public TrySendJobDetailToManagerTimerFake(NodeConfiguration nodeConfiguration, IHttpSender httpSender, double interval) : base(nodeConfiguration, httpSender, interval) { WaitHandle = new ManualResetEventSlim(); }
public NodeStartupNotificationToManagerFake(NodeConfiguration nodeConfiguration, IHttpSender httpSender, double interval = 1000, bool autoReset = false) : base(nodeConfiguration, httpSender, interval, autoReset) { }
public SendJobDoneTimerFake(NodeConfiguration nodeConfiguration, TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer, IHttpSender httpSender, double interval = 1000) : base(nodeConfiguration, sendJobDetailToManagerTimer, httpSender, interval) { }
public void TestFixtureSetUp() { _nodeConfigurationFake = new NodeConfiguration( new Uri(ConfigurationManager.AppSettings["ManagerLocation"]), Assembly.Load(ConfigurationManager.AppSettings["HandlerAssembly"]), 14100, "TestNode", 60); }
public SendJobDoneWithEventTriggerTimerFake(NodeConfiguration nodeConfiguration, Uri callbackTemplateUri, TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer, IHttpSender httpSender) : base(nodeConfiguration, callbackTemplateUri, sendJobDetailToManagerTimer, httpSender) { }
public void SetUp() { var nodeConfiguration = new NodeConfiguration( new Uri(ConfigurationManager.AppSettings["ManagerLocation"]), Assembly.Load(ConfigurationManager.AppSettings["HandlerAssembly"]), 14100, "TestNode", 60); var builder = new ContainerBuilder(); builder.RegisterModule(new NodeModule(nodeConfiguration)); _container = builder.Build(); }
public void Start(NodeConfiguration nodeConfiguration, IContainer container) { if (nodeConfiguration == null) { throw new ArgumentNullException("nodeConfiguration"); } if (container == null) { throw new ArgumentNullException("container"); } var nodeAddress = "http://+:" + nodeConfiguration.BaseAddress.Port + "/"; using (WebApp.Start(nodeAddress, appBuilder => { var containerBuilder = new ContainerBuilder(); containerBuilder.RegisterModule(new NodeModule(nodeConfiguration)); containerBuilder.Update(container); // Configure Web API for self-host. var config = new HttpConfiguration { DependencyResolver = new AutofacWebApiDependencyResolver(container) }; config.MapHttpAttributeRoutes(); config.Services.Add(typeof (IExceptionLogger), new GlobalExceptionLogger()); appBuilder.UseAutofacMiddleware(container); appBuilder.UseAutofacWebApi(config); appBuilder.UseWebApi(config); })) { WhoAmI = nodeConfiguration.CreateWhoIAm(nodeConfiguration.BaseAddress.LocalPath); _logger.InfoWithLineNumber(WhoAmI + ": Node started on machine."); _logger.InfoWithLineNumber(WhoAmI + ": Listening on port " + nodeConfiguration.BaseAddress); //to start it container.Resolve<NodeController>(); _quitEvent.WaitOne(); } }
public void TestFixtureSetUp() { NodeConfiguration = new NodeConfiguration( new Uri(ConfigurationManager.AppSettings["ManagerLocation"]), Assembly.Load(ConfigurationManager.AppSettings["HandlerAssembly"]), 14100, "TestNode", 60); UriToTest = NodeConfiguration.ManagerLocation; Guid = Guid.NewGuid(); HeartBeatTemplateUri = new Uri(UriToTest, ManagerRouteConstants.Heartbeat); NodeHasBeenInitializedTemplateUri = new Uri(UriToTest, ManagerRouteConstants.NodeHasBeenInitialized); JobHasFailedTemplateUri = new Uri(UriToTest, ManagerRouteConstants.JobFailed); JobHasFailedUri = new Uri(JobHasFailedTemplateUri.ToString() .Replace(ManagerRouteConstants.JobIdOptionalParameter, Guid.ToString())); JobHasBeenCanceledTemplateUri = new Uri(UriToTest, ManagerRouteConstants.JobHasBeenCanceled); JobHasBeenCanceledUri = new Uri(JobHasBeenCanceledTemplateUri.ToString() .Replace(ManagerRouteConstants.JobIdOptionalParameter, Guid.ToString())); JobDoneTemplateUri = new Uri(UriToTest, ManagerRouteConstants.JobDone); JobDoneUri = new Uri(JobDoneTemplateUri.ToString() .Replace(ManagerRouteConstants.JobIdOptionalParameter, Guid.ToString())); }
public NodeModule(NodeConfiguration nodeConfiguration) { _nodeConfiguration = nodeConfiguration; }
public NodeController(IWorkerWrapper workerWrapper, NodeConfiguration nodeConfiguration) { _workerWrapper = workerWrapper; NodeConfiguration = nodeConfiguration; }