示例#1
0
        /// <summary>
        /// CreateEncodedConnection to the NATs server using the provided options.
        /// </summary>
        /// <param name="opts">NATs client options</param>
        /// <returns>A new connection to the NATS server</returns>
        public IEncodedConnection CreateEncodedConnection(Options opts)
        {
            EncodedConnection nc = new EncodedConnection(opts);

            nc.connect();
            return(nc);
        }
示例#2
0
        /// <summary>
        /// Attempt to connect to the NATS server, with an encoded connection, using the given options.
        /// </summary>
        /// <param name="opts">The NATS client options to use for this connection.</param>
        /// <returns>An <see cref="IEncodedConnection"/> object connected to the NATS server.</returns>
        /// <exception cref="NATSNoServersException">No connection to a NATS Server could be established.</exception>
        /// <exception cref="NATSConnectionException"><para>A timeout occurred connecting to a NATS Server.</para>
        /// <para>-or-</para>
        /// <para>An exception was encountered while connecting to a NATS Server. See <see cref="Exception.InnerException"/> for more
        /// details.</para></exception>
        public IEncodedConnection CreateEncodedConnection(Options opts)
        {
            EncodedConnection nc = new EncodedConnection(opts);

            try
            {
                nc.connect();
            }
            catch (Exception)
            {
                nc.Dispose();
                throw;
            }
            return(nc);
        }
示例#3
0
 /// <summary>
 /// CreateEncodedConnection to the NATs server using the provided options.
 /// </summary>
 /// <param name="opts">NATs client options</param>
 /// <returns>A new connection to the NATS server</returns>
 public IEncodedConnection CreateEncodedConnection(Options opts)
 {
     EncodedConnection nc = new EncodedConnection(opts);
     nc.connect();
     return nc;
 }