예제 #1
0
        public override void Init()
        {
            base.Init();
            _producers = new LinkedList <IMessageProducer>();
            _consumers = new Hashtable();

            XmlNode nmsNode = this.DestinationDefinition.PropertiesXml.SelectSingleNode("nms");

            _nmsSettings = new NMSSettings(nmsNode);
            if (_nmsSettings != null)
            {
                ConnectionFactory connectionFactory = new ConnectionFactory(_nmsSettings.URI);

                log.Debug(string.Format("NMSAdapter Connected to URI {0}", _nmsSettings.URI));

                _connection = connectionFactory.CreateConnection();
                _connection.Start();
                _session = _connection.CreateSession(AcknowledgementMode.DupsOkAcknowledge);

                if (_nmsSettings.DESTINATION_TYPE.StartsWith(NMSSettings.QueueDestination))
                {
                    _destination = new ActiveMQQueue(_nmsSettings.Destination);
                    log.Debug(string.Format("NMSAdapter Connected to Queue {0}", _nmsSettings.Destination));
                }
                else if (_nmsSettings.DESTINATION_TYPE.StartsWith(NMSSettings.TopicDestination))
                {
                    _destination = new ActiveMQTopic(_nmsSettings.Destination);
                    log.Debug(string.Format("NMSAdapter Connected to Topic {0}", _nmsSettings.Destination));
                }
                else
                {
                    log.Debug(string.Format("Unknown Destination Type {0}", _nmsSettings.DESTINATION_TYPE));
                }
            }
        }
예제 #2
0
        public override void Init()
        {
            base.Init();
            _producers = new LinkedList<IMessageProducer>();
            _consumers = new Hashtable();

            XmlNode nmsNode = this.DestinationDefinition.PropertiesXml.SelectSingleNode("nms");
            _nmsSettings = new NMSSettings(nmsNode);
            if (_nmsSettings != null)
            {
                ConnectionFactory connectionFactory = new ConnectionFactory(_nmsSettings.URI);

                log.Debug(string.Format("NMSAdapter Connected to URI {0}", _nmsSettings.URI));

                _connection = connectionFactory.CreateConnection();
                _connection.Start();
                _session = _connection.CreateSession(AcknowledgementMode.DupsOkAcknowledge);

                if (_nmsSettings.DESTINATION_TYPE.StartsWith(NMSSettings.QueueDestination))
                {
                    _destination = new ActiveMQQueue(_nmsSettings.Destination);
                    log.Debug(string.Format("NMSAdapter Connected to Queue {0}", _nmsSettings.Destination));
                }
                else if (_nmsSettings.DESTINATION_TYPE.StartsWith(NMSSettings.TopicDestination))
                {
                    _destination = new ActiveMQTopic(_nmsSettings.Destination);
                    log.Debug(string.Format("NMSAdapter Connected to Topic {0}", _nmsSettings.Destination));
                }
                else
                {
                    log.Debug(string.Format("Unknown Destination Type {0}", _nmsSettings.DESTINATION_TYPE));
                }
            }
        }