public IConnection CreateConnection(string userName, string password) { ConnectionInfo info = CreateConnectionInfo(userName, password); TcpTransportFactory tcpTransportFactory = new TcpTransportFactory(); ITransport transport = tcpTransportFactory.CreateTransport(brokerUri); Connection connection = new Connection(transport, info); connection.ClientId = info.ClientId; // Set properties on connection using parameters prefixed with "jms." System.Collections.Specialized.StringDictionary map = URISupport.ParseQuery(brokerUri.Query); URISupport.SetProperties(connection, map, "jms."); return(connection); }
public IConnection CreateConnection(string userName, string password) { Uri uri = brokerUri; // Do we need to strip off the activemq prefix?? if ("activemq".Equals(brokerUri.Scheme)) { uri = new Uri(brokerUri.AbsolutePath + brokerUri.Query); } ConnectionInfo info = CreateConnectionInfo(userName, password); ITransportFactory tcpTransportFactory = new TcpTransportFactory(); ITransport transport = tcpTransportFactory.CreateTransport(uri); Connection connection = new Connection(uri, transport, info); // Set properties on connection using parameters prefixed with "connection." System.Collections.Specialized.StringDictionary map = URISupport.ParseQuery(brokerUri.Query); URISupport.SetProperties(connection, map, "connection."); return(connection); }
public ITransport CreateTransport(Uri location) { if (!agent.IsStarted) { agent.Start(); } Uri hostUri = DiscoveredUri; if (null == hostUri) { // If a new broker is found the agent will fire an event which will result in discoveredUri being set. discoveredUriEvent.WaitOne(TIMEOUT_IN_SECONDS * 1000, true); hostUri = DiscoveredUri; if (null == hostUri) { throw new NMSConnectionException(String.Format("Unable to find a connection to {0} before the timeout period expired.", location.ToString())); } } TcpTransportFactory tcpTransFactory = new TcpTransportFactory(); return(tcpTransFactory.CreateTransport(new Uri(hostUri + location.Query))); }