示例#1
0
        /// <summary>
        /// Create a connection to the specified endpoint.
        /// </summary>
        public virtual IConnection CreateConnection()
        {
            IConnection connection;

            try
            {
                if (AutomaticRecoveryEnabled)
                {
                    var autorecoveringConnection = new AutorecoveringConnection(this);
                    autorecoveringConnection.init();
                    connection = autorecoveringConnection;
                }
                else
                {
                    IProtocol protocol = Protocols.DefaultProtocol;
                    connection = protocol.CreateConnection(this, false, CreateFrameHandler());
                }
            }
            catch (Exception e)
            {
                throw new BrokerUnreachableException(e);
            }

            return(connection);
        }
        ///<summary>Create a connection to the specified endpoint.</summary>
        public virtual IConnection CreateConnection()
        {
            IConnection conn = null;

            try
            {
                if (this.AutomaticRecoveryEnabled)
                {
                    AutorecoveringConnection ac = new AutorecoveringConnection(this);
                    ac.init();
                    conn = ac;
                }
                else
                {
                    IProtocol p = Protocols.DefaultProtocol;
                    conn = p.CreateConnection(this, false, this.CreateFrameHandler());
                }
            } catch (Exception e)
            {
                throw new BrokerUnreachableException(e);
            }

            return(conn);
        }