in src/main/csharp/ConnectionFactory.cs [99:147]
public IConnection CreateConnection(string userName, string password)
{
Connection connection = null;
try
{
Tracer.InfoFormat("Connecting to: {0}", brokerUri.ToString());
ITransport transport = TransportFactory.CreateTransport(brokerUri);
connection = new Connection(brokerUri, transport, this.ClientIdGenerator);
connection.UserName = userName;
connection.Password = password;
ConfigureConnection(connection);
if(this.clientId != null)
{
connection.DefaultClientId = this.clientId;
}
return connection;
}
catch(NMSException e)
{
try
{
connection.Close();
}
catch
{
}
throw e;
}
catch(Exception e)
{
try
{
connection.Close();
}
catch
{
}
throw NMSExceptionSupport.Create("Could not connect to broker URL: " + this.brokerUri + ". Reason: " + e.Message, e);
}
}