Beispiel #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);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sends the message to the default destination with the explicit QoS configuration
        /// </summary>
        public void Send(Apache.NMS.IMessage message, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
        {
            Apache.NMS.EMS.Message msg = (Apache.NMS.EMS.Message)message;

            this.tibcoMessageProducer.Send(
                msg.tibcoMessage,
                EMSConvert.ToMessageDeliveryMode(deliveryMode),
                (int)priority,
                (long)timeToLive.TotalMilliseconds);
        }
Beispiel #3
0
        /// <summary>
        /// Sends the message to the default destination with the explicit QoS configuration
        /// </summary>
        public void Send(Apache.NMS.IMessage message, bool persistent, byte priority, TimeSpan timeToLive)
        {
            Apache.NMS.EMS.Message msg = (Apache.NMS.EMS.Message)message;

            this.tibcoMessageProducer.Send(
                msg.tibcoMessage,
                EMSConvert.ToMessageDeliveryMode(persistent),
                priority,
                (long)timeToLive.TotalMilliseconds);
        }
Beispiel #4
0
        private Apache.NMS.EMS.Message GetEMSMessage(Apache.NMS.IMessage message)
        {
            Apache.NMS.EMS.Message msg = (Apache.NMS.EMS.Message)message;

            if (this.ProducerTransformer != null)
            {
                IMessage transformed = this.ProducerTransformer(this.nmsSession, this, message);
                if (transformed != null)
                {
                    msg = (Apache.NMS.EMS.Message)transformed;
                }
            }

            return(msg);
        }
Beispiel #5
0
        /// <summary>
        /// Sends the message to the default destination for this producer
        /// </summary>
        public void Send(Apache.NMS.IMessage message)
        {
            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(
                msg.tibcoMessage,
                this.tibcoMessageProducer.MsgDeliveryMode,
                this.tibcoMessageProducer.Priority,
                timeToLive);
        }
Beispiel #6
0
        /// <summary>
        /// Sends the message to the default destination with the explicit QoS configuration
        /// </summary>
        public void Send(Apache.NMS.IMessage message, MsgDeliveryMode deliveryMode, MsgPriority priority, TimeSpan timeToLive)
        {
            Apache.NMS.EMS.Message msg = GetEMSMessage(message);

            try
            {
                this.tibcoMessageProducer.Send(
                    msg.tibcoMessage,
                    EMSConvert.ToMessageDeliveryMode(deliveryMode),
                    (int)priority,
                    (long)timeToLive.TotalMilliseconds);
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
            }
        }
Beispiel #7
0
 /// <summary>
 /// Method DequeueNoWait
 /// </summary>
 public Apache.NMS.IMessage DequeueNoWait()
 {
     Apache.NMS.EMS.Message rc = null;
     lock (semaphore)
     {
         if (!m_bClosed && queue.Count > 0)
         {
             rc = (Apache.NMS.EMS.Message)queue.Dequeue();
             if (null != rc)
             {
                 rc.ReadOnlyBody       = true;
                 rc.ReadOnlyProperties = true;
             }
         }
     }
     return(rc);
 }