public async Task Handle(MqClient client, HorseMessage message, bool fromNode) { if (string.IsNullOrEmpty(message.Target)) { return; } if (message.Target.StartsWith("@name:")) { List <MqClient> receivers = _server.FindClientByName(message.Target.Substring(6)); if (receivers.Count > 0) { if (message.HighPriority && receivers.Count > 1) { MqClient first = receivers.FirstOrDefault(); receivers.Clear(); receivers.Add(first); } await ProcessMultipleReceiverClientMessage(client, receivers, message); } else if (message.WaitResponse) { await client.SendAsync(message.CreateResponse(HorseResultCode.NotFound)); } } else if (message.Target.StartsWith("@type:")) { List <MqClient> receivers = _server.FindClientByType(message.Target.Substring(6)); if (receivers.Count > 0) { if (message.HighPriority) { MqClient first = receivers.FirstOrDefault(); receivers.Clear(); receivers.Add(first); } await ProcessMultipleReceiverClientMessage(client, receivers, message); } else if (message.WaitResponse) { await client.SendAsync(message.CreateResponse(HorseResultCode.NotFound)); } } else { await ProcessSingleReceiverClientMessage(client, message); } }