bool TryGetMatchingHost(Uri address, out IServiceBusHost host)
        {
            host = _hosts.GetHosts(address)
                   .Cast <IServiceBusHost>()
                   .OrderByDescending(x => address.AbsolutePath.StartsWith(x.Settings.ServiceUri.AbsolutePath, StringComparison.OrdinalIgnoreCase)
                    ? 1
                    : 0)
                   .FirstOrDefault();

            return(host != null);
        }
Esempio n. 2
0
        public Task <ISendTransport> GetSendTransport(Uri address)
        {
            var host = _hosts.GetHosts(address).FirstOrDefault();

            if (host == null)
            {
                throw new EndpointNotFoundException("The endpoint address specified an unknown host: " + address);
            }

            var sendSettings = address.GetSendSettings();

            var modelCache = new RabbitMqModelCache(host);

            return(Task.FromResult <ISendTransport>(new RabbitMqSendTransport(modelCache, sendSettings)));
        }
        public Task <ISendTransport> GetSendTransport(Uri address)
        {
            var sendSettings = address.GetSendSettings();

            var host = _hosts.GetHosts(address).FirstOrDefault();

            if (host == null)
            {
                throw new EndpointNotFoundException("The endpoint address specified an unknown host: " + address);
            }

            var clientCache = new HttpClientCache(_hosts[0].Supervisor, _receivePipe);

            return(Task.FromResult <ISendTransport>(new HttpSendTransport(clientCache, sendSettings, _receiveObserver)));
        }