Apache.NMS.ActiveMQ.Transport.TransportFactory.CreateTransportFactory C# (CSharp) Method

CreateTransportFactory() private static method

Create a transport factory for the scheme. If we do not support the transport protocol, an NMSConnectionException will be thrown.
private static CreateTransportFactory ( Uri location ) : ITransportFactory
location System.Uri
return ITransportFactory
        private static ITransportFactory CreateTransportFactory(Uri location)
        {
            string scheme = location.Scheme;

            if(string.IsNullOrEmpty(scheme))
            {
                throw new NMSConnectionException(String.Format("Transport scheme invalid: [{0}]", location.ToString()));
            }

            ITransportFactory factory = null;

            try
            {
                factory = NewInstance(scheme.ToLower());
            }
            catch(NMSConnectionException)
            {
                throw;
            }
            catch
            {
                throw new NMSConnectionException("Error creating transport.");
            }

            if(null == factory)
            {
                throw new NMSConnectionException("Unable to create a transport.");
            }

            return factory;
        }

Usage Example

Beispiel #1
0
        public static ITransport CompositeConnect(Uri location)
        {
            ITransportFactory tf = TransportFactory.CreateTransportFactory(location);

            return(tf.CompositeConnect(location));
        }
All Usage Examples Of Apache.NMS.ActiveMQ.Transport.TransportFactory::CreateTransportFactory