예제 #1
0
        public WorkerWrapper(IInvokeHandler invokeHandler,
                             NodeConfiguration nodeConfiguration,
                             TrySendNodeStartUpNotificationToManagerTimer nodeStartUpNotificationToManagerTimer,
                             Timer pingToManagerTimer,
                             TrySendJobDoneStatusToManagerTimer trySendJobDoneStatusToManagerTimer,
                             TrySendJobCanceledToManagerTimer trySendJobCanceledStatusToManagerTimer,
                             TrySendJobFaultedToManagerTimer trySendJobFaultedStatusToManagerTimer,
                             TrySendJobDetailToManagerTimer trySendJobDetailToManagerTimer, JobDetailSender jobDetailSender)
        {
            _handler           = invokeHandler;
            _nodeConfiguration = nodeConfiguration;
            WhoamI             = _nodeConfiguration.CreateWhoIAm(Environment.MachineName);

            _nodeStartUpNotificationToManagerTimer = nodeStartUpNotificationToManagerTimer;
            _nodeStartUpNotificationToManagerTimer.TrySendNodeStartUpNotificationSucceded +=
                NodeStartUpNotificationToManagerTimer_TrySendNodeStartUpNotificationSucceded;

            _pingToManagerTimer = pingToManagerTimer;
            _trySendJobDoneStatusToManagerTimer     = trySendJobDoneStatusToManagerTimer;
            _trySendJobCanceledStatusToManagerTimer = trySendJobCanceledStatusToManagerTimer;
            _trySendJobFaultedStatusToManagerTimer  = trySendJobFaultedStatusToManagerTimer;
            _trySendJobDetailToManagerTimer         = trySendJobDetailToManagerTimer;
            _jobDetailSender = jobDetailSender;

            IsWorking = false;

            _trySendJobDetailToManagerTimer.Start();
            _nodeStartUpNotificationToManagerTimer.Start();
        }
예제 #2
0
		public WorkerWrapper(IInvokeHandler invokeHandler,
		                     NodeConfiguration nodeConfiguration,
		                     TrySendNodeStartUpNotificationToManagerTimer nodeStartUpNotificationToManagerTimer,
		                     Timer pingToManagerTimer,
		                     TrySendJobDoneStatusToManagerTimer trySendJobDoneStatusToManagerTimer,
		                     TrySendJobCanceledToManagerTimer trySendJobCanceledStatusToManagerTimer,
		                     TrySendJobFaultedToManagerTimer trySendJobFaultedStatusToManagerTimer,
		                     TrySendJobDetailToManagerTimer trySendJobDetailToManagerTimer)
		{
			_handler = invokeHandler;
			_nodeConfiguration = nodeConfiguration;
			WhoamI = _nodeConfiguration.CreateWhoIAm(Environment.MachineName);

			_nodeStartUpNotificationToManagerTimer = nodeStartUpNotificationToManagerTimer;
			_nodeStartUpNotificationToManagerTimer.TrySendNodeStartUpNotificationSucceded +=
				NodeStartUpNotificationToManagerTimer_TrySendNodeStartUpNotificationSucceded;

			_pingToManagerTimer = pingToManagerTimer;
			_trySendJobDoneStatusToManagerTimer = trySendJobDoneStatusToManagerTimer;
			_trySendJobCanceledStatusToManagerTimer = trySendJobCanceledStatusToManagerTimer;
			_trySendJobFaultedStatusToManagerTimer = trySendJobFaultedStatusToManagerTimer;
			_trySendJobDetailToManagerTimer = trySendJobDetailToManagerTimer;

			isWorking = false;

			_trySendJobDetailToManagerTimer.Start();
			_nodeStartUpNotificationToManagerTimer.Start();
		}
예제 #3
0
        public PingToManagerTimer(NodeConfiguration nodeConfiguration,
                                  IHttpSender httpSender) : base(nodeConfiguration.PingToManagerSeconds * 1000)
        {
            _cancellationTokenSource = new CancellationTokenSource();
            _exceptionLoggerHandler  = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());
            _nodeConfiguration       = nodeConfiguration;
            _httpSender = httpSender;
            _whoAmI     = nodeConfiguration.CreateWhoIAm(Environment.MachineName);

            Elapsed += OnTimedEvent;
        }
예제 #4
0
		public PingToManagerTimer(NodeConfiguration nodeConfiguration,
		                          IHttpSender httpSender) : base(nodeConfiguration.PingToManagerSeconds*1000)
		{
			_cancellationTokenSource = new CancellationTokenSource();

			_nodeConfiguration = nodeConfiguration;
			_httpSender = httpSender;
			_whoAmI = nodeConfiguration.CreateWhoIAm(Environment.MachineName);

			Elapsed += OnTimedEvent;
		}
		public TrySendStatusToManagerTimer(NodeConfiguration nodeConfiguration,
		                                   Uri callbackTemplateUri,
		                                   TrySendJobDetailToManagerTimer sendJobDetailToManagerTimer,
		                                   IHttpSender httpSender, double interval = 500) : base(interval)
		{
			_cancellationTokenSource = new CancellationTokenSource();
			_whoAmI = nodeConfiguration.CreateWhoIAm(Environment.MachineName);
			_sendJobDetailToManagerTimer = sendJobDetailToManagerTimer;
			_httpSender = httpSender;
			CallbackTemplateUri = callbackTemplateUri;

			Elapsed += OnTimedEvent;
			AutoReset = true;
		}
		public TrySendNodeStartUpNotificationToManagerTimer(NodeConfiguration nodeConfiguration,
		                                                    IHttpSender httpSender,
		                                                    double interval = 5000,
		                                                    bool autoReset = true) : base(interval)
		{
			var callbackToManagerTemplateUri = nodeConfiguration.GetManagerNodeHasBeenInitializedUri();
			_cancellationTokenSource = new CancellationTokenSource();
			_nodeConfiguration = nodeConfiguration;
			_callbackToManagerTemplateUri = callbackToManagerTemplateUri;
			_httpSender = httpSender;
			_whoAmI = _nodeConfiguration.CreateWhoIAm(Environment.MachineName);

			Elapsed += OnTimedEvent;
			AutoReset = autoReset;
		}
        public TrySendStatusToManagerTimer(NodeConfiguration nodeConfiguration,
                                           Uri callbackTemplateUri,
                                           JobDetailSender jobDetailSender,
                                           IHttpSender httpSender, double interval = 500) : base(interval)
        {
            _cancellationTokenSource = new CancellationTokenSource();
            _whoAmI                 = nodeConfiguration.CreateWhoIAm(Environment.MachineName);
            _enableGc               = nodeConfiguration.EnableGarbageCollection;
            _jobDetailSender        = jobDetailSender;
            _httpSender             = httpSender;
            CallbackTemplateUri     = callbackTemplateUri;
            _exceptionLoggerHandler = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());

            Elapsed  += OnTimedEvent;
            AutoReset = true;
        }
        public TrySendNodeStartUpNotificationToManagerTimer(NodeConfiguration nodeConfiguration,
                                                            IHttpSender httpSender,
                                                            double interval = 5000,
                                                            bool autoReset  = true) : base(interval)
        {
            var callbackToManagerTemplateUri = nodeConfiguration.GetManagerNodeHasBeenInitializedUri();

            _cancellationTokenSource      = new CancellationTokenSource();
            _nodeConfiguration            = nodeConfiguration;
            _callbackToManagerTemplateUri = callbackToManagerTemplateUri;
            _httpSender             = httpSender;
            _whoAmI                 = _nodeConfiguration.CreateWhoIAm(Environment.MachineName);
            _exceptionLoggerHandler = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());

            Elapsed  += OnTimedEvent;
            AutoReset = autoReset;
        }