Example #1
0
        /// <summary>
        /// Unsubscribes from the queue and sends response
        /// </summary>
        private async Task Unsubscribe(MqClient client, HorseMessage message)
        {
            HorseQueue queue = _server.FindQueue(message.Target);

            if (queue == null)
            {
                if (message.WaitResponse)
                {
                    await client.SendAsync(message.CreateResponse(HorseResultCode.NotFound));
                }

                return;
            }

            bool success = await queue.RemoveClient(client);

            if (message.WaitResponse)
            {
                await client.SendAsync(message.CreateResponse(success ? HorseResultCode.Ok : HorseResultCode.NotFound));
            }
        }