private void TellLoadBalancerThatWeAreReadyToWorkForAllThreads()
 {
     var readyToWork = new object[theTransport.ThreadCount];
     for (var i = 0; i < theTransport.ThreadCount; i++)
     {
         readyToWork[i] = new ReadyToWork
         {
             Endpoint = theTransport.Endpoint.Uri
         };
     }
     var endpoint = endpointRouter.GetRoutedEndpoint(loadBalancerEndpoint);
     logger.DebugFormat("Telling load balancer {0} that we {1} are ready to do work in {2} threads",
                        endpoint,
                        theTransport.Endpoint,
                        readyToWork.Length);
     theTransport.Send(endpoint, readyToWork);
 }
Esempio n. 2
0
		private void AddWorkerToQueue(OpenedQueue queue, ReadyToWork work)
		{
			var persistedWorker = new Message
			{
				Formatter = new XmlMessageFormatter(new[] { typeof(string) }),
				Body = work.Endpoint.ToString(),
				Label = ("Known worker: " + work.Endpoint).EnsureLabelLength()
			};
			logger.InfoFormat("New worker: {0}", work.Endpoint);
			queue.Send(persistedWorker.SetSubQueueToSendTo(SubQueue.Workers));

			SendToQueue(secondaryLoadBalancer, new NewWorkerPersisted
			{
				Endpoint = work.Endpoint
			});
			Raise(SentNewWorkerPersisted);
		}
Esempio n. 3
0
		private void HandleReadyForWork(OpenedQueue queue, ReadyToWork work)
		{
			logger.DebugFormat("{0} is ready to work", work.Endpoint);
			var needToAddToQueue = KnownWorkers.Add(work.Endpoint);

			if (needToAddToQueue)
				AddWorkerToQueue(queue, work);

			readyForWork.Enqueue(work.Endpoint);
		}