static string GetTopic(Location location, WhichWarehouses whichWarehouses)
        {
            string topic = "Warehouse.";

            switch (whichWarehouses)
            {
            case WhichWarehouses.All:
                topic = topic + "*";
                break;

            case WhichWarehouses.City:
                topic = topic + location.Country + "." + location.Municipality;
                break;

            case WhichWarehouses.Country:
                topic = topic + location.Country + ".*";
                break;

            default:
                break;
            }
            return(topic);
        }
        public HTTPRequest_WarehouseToRetail PublishToWarehouse(Location location, HTTPRequest_RetailToWarehouse request, WhichWarehouses whichWarehouses = WhichWarehouses.All)
        {
            string topic = GetTopic(location, whichWarehouses);

            using (bus)
            {
                Console.WriteLine("Publishing with topic: " + topic);
                //var message = new TextMessage { Text = topic };
                bus.Publish <HTTPRequest_RetailToWarehouse>(request, topic);

                Console.WriteLine("Subscribing to topic: " + topic);
                bus.Subscribe <HTTPRequest_WarehouseToRetail>("subscriber" + id, HandleResponse, x => x.WithTopic(topic));
                Console.WriteLine("Listening for messages.");

                lock (this)
                {
                    gotReply = Monitor.Wait(this, 3000);
                }

                if (gotReply)
                {
                    return(toReturn);
                }
                else
                {
                    return(new HTTPRequest_WarehouseToRetail());
                }
            }
        }