public IEndpoint CreateEndpoint(Uri uri)
		{
			string scheme = uri.Scheme.ToLowerInvariant();

			ITransportFactory transportFactory;
			if (_transportFactories.TryGetValue(scheme, out transportFactory))
			{
				try
				{
					EndpointBuilder builder = _endpointBuilders.Retrieve(uri, () =>
						{
							var configurator = new EndpointConfiguratorImpl(uri, _defaults);

							return configurator.CreateBuilder();
						});

					return builder.CreateEndpoint(transportFactory);
				}
				catch (Exception ex)
				{
					throw new EndpointException(uri, "Failed to create endpoint", ex);
				}
			}

			throw new ConfigurationException("The {0} scheme was not handled by any registered transport.".FormatWith(uri.Scheme));
		}
示例#2
0
        public IEndpoint CreateEndpoint(Uri requestedUri)
        {
            string scheme = requestedUri.Scheme.ToLowerInvariant();

            if (_transportFactories.Has(scheme))
            {
                ITransportFactory transportFactory = _transportFactories[scheme];
                try
                {
                    IEndpointAddress address = transportFactory.GetAddress(requestedUri, _defaults.RequireTransactional ||
                        (_defaults.CreateMissingQueues && _defaults.CreateTransactionalQueues));

                    var uriPath = new Uri(address.Uri.GetLeftPart(UriPartial.Path));
                    EndpointBuilder builder = _endpointBuilders.Get(uriPath, key =>
                        {
                            var configurator = new EndpointConfiguratorImpl(address, _defaults);
                            return configurator.CreateBuilder();
                        });

                    return builder.CreateEndpoint(transportFactory);
                }
                catch (Exception ex)
                {
                    throw new EndpointException(requestedUri, "Failed to create endpoint", ex);
                }
            }

            throw new ConfigurationException(
                "The {0} scheme was not handled by any registered transport.".FormatWith(requestedUri.Scheme));
        }
示例#3
0
        public IEndpoint CreateEndpoint(Uri requestedUri)
        {
            string scheme = requestedUri.Scheme.ToLowerInvariant();

            if (_transportFactories.Has(scheme))
            {
                ITransportFactory transportFactory = _transportFactories[scheme];
                try
                {
                    IEndpointAddress address = transportFactory.GetAddress(requestedUri, _defaults.RequireTransactional ||
                                                                           (_defaults.CreateMissingQueues && _defaults.CreateTransactionalQueues));

                    var             uriPath = new Uri(address.Uri.GetLeftPart(UriPartial.Path));
                    EndpointBuilder builder = _endpointBuilders.Get(uriPath, key =>
                    {
                        var configurator = new EndpointConfiguratorImpl(address, _defaults);
                        return(configurator.CreateBuilder());
                    });

                    return(builder.CreateEndpoint(transportFactory));
                }
                catch (Exception ex)
                {
                    throw new EndpointException(requestedUri, "Failed to create endpoint", ex);
                }
            }

            throw new ConfigurationException(
                      "The {0} scheme was not handled by any registered transport.".FormatWith(requestedUri.Scheme));
        }
示例#4
0
        public IEndpoint CreateEndpoint(Uri uri)
        {
            string scheme = uri.Scheme.ToLowerInvariant();

            ITransportFactory transportFactory;

            if (_transportFactories.TryGetValue(scheme, out transportFactory))
            {
                try
                {
                    EndpointBuilder builder = _endpointBuilders.Retrieve(uri, () =>
                    {
                        var configurator = new EndpointConfiguratorImpl(uri, _defaults);

                        return(configurator.CreateBuilder());
                    });

                    return(builder.CreateEndpoint(transportFactory));
                }
                catch (Exception ex)
                {
                    throw new EndpointException(uri, "Failed to create endpoint", ex);
                }
            }

            throw new ConfigurationException("The {0} scheme was not handled by any registered transport.".FormatWith(uri.Scheme));
        }
        /// <summary>
        /// Returns a configurator for the specified endpoint URI
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="uri"></param>
        /// <returns></returns>
        public static EndpointConfigurator ConfigureEndpoint <T>(this T configurator, Uri uri)
            where T : EndpointFactoryConfigurator
        {
            var endpointConfigurator = new EndpointConfiguratorImpl(new EndpointAddress(uri), configurator.Defaults);

            configurator.AddEndpointFactoryConfigurator(endpointConfigurator);

            return(endpointConfigurator);
        }