void HandleControlMessage(TransportMessage controlMessage) { var replyToAddress = controlMessage.ReplyToAddress; if (LicenseConfig.LimitNumberOfWorkers(replyToAddress)) { return; } string messageSessionId; if (!controlMessage.Headers.TryGetValue(Headers.WorkerSessionId, out messageSessionId)) { messageSessionId = String.Empty; } if (controlMessage.Headers.ContainsKey(Headers.WorkerStarting)) { var capacity = int.Parse(controlMessage.Headers[Headers.WorkerCapacityAvailable]); WorkerAvailabilityManager.RegisterNewWorker(new Worker(replyToAddress, messageSessionId), capacity); return; } WorkerAvailabilityManager.WorkerAvailable(new Worker(replyToAddress, messageSessionId)); }
private void HandleControlMessage(TransportMessage controlMessage) { var replyToAddress = controlMessage.ReplyToAddress; if (LicenseConfig.LimitNumberOfWorkers(replyToAddress)) { return; } if (controlMessage.Headers.ContainsKey(Headers.WorkerStarting)) { WorkerAvailabilityManager.ClearAvailabilityForWorker(replyToAddress); Logger.InfoFormat("Worker {0} has started up, clearing previous reported capacity", replyToAddress); } string workerCapacityAvailable; if (controlMessage.Headers.TryGetValue(Headers.WorkerCapacityAvailable, out workerCapacityAvailable)) { var capacity = int.Parse(workerCapacityAvailable); WorkerAvailabilityManager.WorkerAvailable(replyToAddress, capacity); Logger.InfoFormat("Worker {0} checked in with available capacity: {1}", replyToAddress, capacity); } }
private void Handle(ReadyMessage message, string returnAddress) { Configurer.Logger.Info("Server available: " + returnAddress); if (message.ClearPreviousFromThisAddress) //indicates worker started up { WorkerAvailabilityManager.ClearAvailabilityForWorker(returnAddress); } WorkerAvailabilityManager.WorkerAvailable(returnAddress); }
void HandleControlMessage(TransportMessage controlMessage) { var replyToAddress = controlMessage.ReplyToAddress; if (controlMessage.Headers.ContainsKey(Headers.WorkerStarting)) { WorkerAvailabilityManager.ClearAvailabilityForWorker(replyToAddress); Logger.InfoFormat("Worker {0} has started up, clearing previous reported capacity", replyToAddress); } if (controlMessage.Headers.ContainsKey(Headers.WorkerCapacityAvailable)) { var capacity = int.Parse(controlMessage.Headers[Headers.WorkerCapacityAvailable]); WorkerAvailabilityManager.WorkerAvailable(replyToAddress, capacity); Logger.InfoFormat("Worker {0} checked in with available capacity: {1}", replyToAddress, capacity); } }
void HandleDisconnectMessage(TransportMessage controlMessage) { var workerAddress = Address.Parse(controlMessage.Headers[Headers.UnregisterWorker]); WorkerAvailabilityManager.UnregisterWorker(workerAddress); }