static EMSQueueConnection() /* Static Constructor for creating Connection at Start-up */ { try { SetEnvironment(); Hashtable Environment = LC.Settings; /* Username , password and targetHostname were already retrieved in SetEnv.At present , we are assuming that lookup JNDI and connectiing QCF are of same provider */ String username = Environment[LookupContext.SECURITY_PRINCIPAL].ToString(); String password = Environment[LookupContext.SECURITY_CREDENTIALS].ToString(); /*QCF and CLient-ID are not required for SetEnv/Lookup obviously. Hence now retriving from config. */ string ClientID = System.Configuration.ConfigurationManager.ConnectionStrings["Client-ID"].ConnectionString; string QueueConnectionFactory = System.Configuration.ConfigurationManager.ConnectionStrings["QueueConnectionFactory"].ConnectionString; QueueConnectionFactory QCF = (QueueConnectionFactory)LC.Lookup(QueueConnectionFactory); QCF.SetClientID(ClientID); if (Environment[LookupContext.SECURITY_PROTOCOL].ToString().Equals("ssl")) { Console.WriteLine("########### QCF=" + QCF.ToString()); QCF.SetTargetHostName(Environment[LookupContext.SSL_TARGET_HOST_NAME].ToString()); } connection = (QueueConnection)QCF.CreateQueueConnection(username, password); connection.ExceptionHandler += new EMSExceptionHandler(_HandleException); connection.Start(); } catch (Exception E) { Console.WriteLine("\n###############\nERROR thrown in EMSQueueConnection Constructor :" + E.ToString()); if (E is EMSException) { EMSException je = (EMSException)E; if (je.LinkedException != null) { System.Console.WriteLine("##### Linked Exception:"); System.Console.WriteLine(je.LinkedException.StackTrace); } } } }