/// <summary> /// Creates a new connection to TIBCO. /// </summary> public Apache.NMS.IConnection CreateConnection(string userName, string password) { Apache.NMS.IConnection connection = null; try { connection = EMSConvert.ToNMSConnection(this.tibcoConnectionFactory.CreateConnection(userName, password)); ConfigureConnection(connection); } catch (Exception ex) { ExceptionUtil.WrapAndThrowNMSException(ex); } return(connection); }
/// <summary> /// Creates a new connection to TIBCO. /// </summary> public Apache.NMS.IConnection CreateConnection(string userName, string password) { Apache.NMS.IConnection connection = null; try { connection = EMSConvert.ToNMSConnection(this.tibcoConnectionFactory.CreateConnection(userName, password)); connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy; } catch (Exception ex) { ExceptionUtil.WrapAndThrowNMSException(ex); } return(connection); }
/// <summary> /// Opens a connection to the server. /// <para /> /// By default, it uses 3 system environment variables as parameters /// <para /> /// VHMSG_SERVER - This specifies the server to connect to. It can either be an ip address or domain name /// <para /> /// VHMSG_PORT - This specifies the port to connect to. /// <para /> /// VHMSG_SCOPE - A unique id used to distinguish messages sent by different modules using the same server. For example, if two users /// are using the same server, they would set different scopes so that they wouldn't receives each other's messages. /// </summary> public void OpenConnection() { string user = null; // ActiveMQConnection.DEFAULT_USER; string password = null; // ActiveMQConnection.DEFAULT_PASSWORD; string url = Apache.NMS.ActiveMQ.ConnectionFactory.DEFAULT_BROKER_URL; bool topic = true; //bool transacted = false; Apache.NMS.AcknowledgementMode ackMode = Apache.NMS.AcknowledgementMode.AutoAcknowledge; url = "tcp://" + m_host + ":" + m_port; //System.out.println("getConnection(): " + url + " " + m_scope ); Apache.NMS.ActiveMQ.ConnectionFactory connectionFactory = new Apache.NMS.ActiveMQ.ConnectionFactory(new Uri(url)); connection = connectionFactory.CreateConnection(user, password); //connection.setExceptionListener( this ); connection.Start(); //m_session = connection.CreateSession( transacted, ackMode ); m_session = connection.CreateSession(ackMode); if (topic) { m_destination = m_session.GetTopic(m_scope); } else { m_destination = m_session.GetQueue(m_scope); } m_Producer = m_session.CreateProducer(m_destination); m_Producer.DeliveryMode = Apache.NMS.MsgDeliveryMode.NonPersistent; // Persistent = false; // m_Producer.setDeliveryMode( DeliveryMode.NON_PERSISTENT ); }
/// <summary> /// Opens a connection to the server. /// <para /> /// By default, it uses 3 system environment variables as parameters /// <para /> /// VHMSG_SERVER - This specifies the server to connect to. It can either be an ip address or domain name /// <para /> /// VHMSG_PORT - This specifies the port to connect to. /// <para /> /// VHMSG_SCOPE - A unique id used to distinguish messages sent by different modules using the same server. For example, if two users /// are using the same server, they would set different scopes so that they wouldn't receives each other's messages. /// </summary> public void OpenConnection() { string user = null; // ActiveMQConnection.DEFAULT_USER; string password = null; // ActiveMQConnection.DEFAULT_PASSWORD; string url = Apache.NMS.ActiveMQ.ConnectionFactory.DEFAULT_BROKER_URL; bool topic = true; //bool transacted = false; Apache.NMS.AcknowledgementMode ackMode = Apache.NMS.AcknowledgementMode.AutoAcknowledge; url = "tcp://" + m_host + ":" + m_port; //System.out.println("getConnection(): " + url + " " + m_scope ); Apache.NMS.ActiveMQ.ConnectionFactory connectionFactory = new Apache.NMS.ActiveMQ.ConnectionFactory(new Uri(url)); connection = connectionFactory.CreateConnection(user, password); //connection.setExceptionListener( this ); connection.Start(); //m_session = connection.CreateSession( transacted, ackMode ); m_session = connection.CreateSession(ackMode); if (topic) { m_destination = m_session.GetTopic(m_scope); } else { m_destination = m_session.GetQueue(m_scope); } m_Producer = m_session.CreateProducer(m_destination); m_Producer.DeliveryMode = Apache.NMS.MsgDeliveryMode.NonPersistent; // Persistent = false; // m_Producer.setDeliveryMode( DeliveryMode.NON_PERSISTENT ); }