コード例 #1
0
        /// <summary>
        /// Sends the message to the given destination
        /// </summary>
        public void Send(Apache.NMS.IDestination destination, Apache.NMS.IMessage message)
        {
            Apache.NMS.EMS.Destination dest = (Apache.NMS.EMS.Destination)destination;
            Apache.NMS.EMS.Message     msg  = GetEMSMessage(message);
            long timeToLive = (long)message.NMSTimeToLive.TotalMilliseconds;

            if (0 == timeToLive)
            {
                timeToLive = this.tibcoMessageProducer.TimeToLive;
            }

            try
            {
                this.tibcoMessageProducer.Send(
                    dest.tibcoDestination,
                    msg.tibcoMessage,
                    this.tibcoMessageProducer.MsgDeliveryMode,
                    this.tibcoMessageProducer.Priority,
                    timeToLive);
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
            }
        }
コード例 #2
0
ファイル: EMSConvert.cs プロジェクト: apache/activemq-nms-ems
        public static TIBCO.EMS.Destination ToEMSDestination(Apache.NMS.IDestination nmsDestination)
        {
            if (nmsDestination is Apache.NMS.EMS.Destination)
            {
                return(((Apache.NMS.EMS.Destination)nmsDestination).tibcoDestination);
            }

            return(null);
        }
コード例 #3
0
 /// <summary>
 /// Converts an NMS destination
 /// into an IBM XMS destination.
 /// </summary>
 /// <param name="nmsDestination">NMS destination.</param>
 /// <returns>IBM XMS destination.</returns>
 public static IBM.XMS.IDestination ToXMSDestination(
     Apache.NMS.IDestination nmsDestination)
 {
     if (nmsDestination is Apache.NMS.XMS.Destination)
     {
         return(((Apache.NMS.XMS.Destination)nmsDestination).xmsDestination);
     }
     return(null);
 }
コード例 #4
0
        /// <summary>
        /// Sends the message to the given destination with the explicit QoS configuration
        /// </summary>
        public void Send(Apache.NMS.IDestination destination, Apache.NMS.IMessage message,
                         MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
        {
            Apache.NMS.EMS.Destination dest = (Apache.NMS.EMS.Destination)destination;
            Apache.NMS.EMS.Message     msg  = (Apache.NMS.EMS.Message)message;

            this.tibcoMessageProducer.Send(
                dest.tibcoDestination,
                msg.tibcoMessage,
                EMSConvert.ToMessageDeliveryMode(deliveryMode),
                (int)priority,
                (long)timeToLive.TotalMilliseconds);
        }
コード例 #5
0
        /// <summary>
        /// Sends the message to the given destination with the explicit QoS configuration
        /// </summary>
        public void Send(Apache.NMS.IDestination destination, Apache.NMS.IMessage message,
                         bool persistent, byte priority, TimeSpan timeToLive)
        {
            Apache.NMS.EMS.Destination dest = (Apache.NMS.EMS.Destination)destination;
            Apache.NMS.EMS.Message     msg  = (Apache.NMS.EMS.Message)message;

            this.tibcoMessageProducer.Send(
                dest.tibcoDestination,
                msg.tibcoMessage,
                EMSConvert.ToMessageDeliveryMode(persistent),
                priority,
                (long)timeToLive.TotalMilliseconds);
        }
コード例 #6
0
        public Apache.NMS.IMessageConsumer CreateConsumer(Apache.NMS.IDestination destination, string selector, bool noLocal)
        {
            Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination)destination;

            try
            {
                return(EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination, selector, noLocal)));
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
                return(null);
            }
        }
コード例 #7
0
        public Apache.NMS.IMessageProducer CreateProducer(Apache.NMS.IDestination destination)
        {
            Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination)destination;

            try
            {
                return(EMSConvert.ToNMSMessageProducer(this, this.tibcoSession.CreateProducer(destinationObj.tibcoDestination)));
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
                return(null);
            }
        }
コード例 #8
0
        public Apache.NMS.IMessageConsumer CreateConsumer(Apache.NMS.IDestination destination)
        {
            Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination)destination;

            try
            {
                Apache.NMS.IMessageConsumer consumer = EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination));
                ConfigureConsumer(consumer);
                return(consumer);
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
                return(null);
            }
        }
コード例 #9
0
        /// <summary>
        /// Sends the message to the given destination
        /// </summary>
        public void Send(Apache.NMS.IDestination destination, Apache.NMS.IMessage message)
        {
            Apache.NMS.EMS.Destination dest = (Apache.NMS.EMS.Destination)destination;
            Apache.NMS.EMS.Message     msg  = (Apache.NMS.EMS.Message)message;
            long timeToLive = (long)message.NMSTimeToLive.TotalMilliseconds;

            if (0 == timeToLive)
            {
                timeToLive = this.tibcoMessageProducer.TimeToLive;
            }

            this.tibcoMessageProducer.Send(
                dest.tibcoDestination,
                msg.tibcoMessage,
                this.tibcoMessageProducer.MsgDeliveryMode,
                this.tibcoMessageProducer.Priority,
                timeToLive);
        }
コード例 #10
0
        /// <summary>
        /// Sends the message to the given destination with the explicit QoS configuration
        /// </summary>
        public void Send(Apache.NMS.IDestination destination, Apache.NMS.IMessage message,
                         MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
        {
            Apache.NMS.EMS.Destination dest = (Apache.NMS.EMS.Destination)destination;
            Apache.NMS.EMS.Message     msg  = GetEMSMessage(message);

            try
            {
                this.tibcoMessageProducer.Send(
                    dest.tibcoDestination,
                    msg.tibcoMessage,
                    EMSConvert.ToMessageDeliveryMode(deliveryMode),
                    (int)priority,
                    (long)timeToLive.TotalMilliseconds);
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
            }
        }
コード例 #11
0
ファイル: vhmsg.cs プロジェクト: USC-ICT/elsender
        /// <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 );
        }
コード例 #12
0
        public Apache.NMS.IMessageConsumer CreateConsumer(Apache.NMS.IDestination destination, string selector, bool noLocal)
        {
            Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination)destination;

            return(EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination, selector, noLocal)));
        }
コード例 #13
0
        public Apache.NMS.IMessageConsumer CreateConsumer(Apache.NMS.IDestination destination)
        {
            Apache.NMS.EMS.Destination destinationObj = (Apache.NMS.EMS.Destination)destination;

            return(EMSConvert.ToNMSMessageConsumer(this, this.tibcoSession.CreateConsumer(destinationObj.tibcoDestination)));
        }
コード例 #14
0
ファイル: vhmsg.cs プロジェクト: Juncai/MSMiddleMan
        /// <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 );
        }