/// <summary> /// Sends the message to the given destination. /// </summary> public void Send(Apache.NMS.IDestination destination, Apache.NMS.IMessage message) { Apache.NMS.XMS.Destination dest = (Apache.NMS.XMS.Destination)destination; Apache.NMS.XMS.Message msg = GetXMSMessage(message); long timeToLive = (long)message.NMSTimeToLive.TotalMilliseconds; if (0 == timeToLive) { timeToLive = this.xmsMessageProducer.TimeToLive; } try { this.xmsMessageProducer.Send( dest.xmsDestination, msg.xmsMessage, this.xmsMessageProducer.DeliveryMode, this.xmsMessageProducer.Priority, timeToLive); } catch (Exception ex) { ExceptionUtil.WrapAndThrowNMSException(ex); } }
public IMessageConsumer CreateConsumer(Queue queue, string selector = null) { if (this.queueConnection.IsStarted) { throw new QueueingException("Cannot create consumer on an already opened connection. Create new session instead."); } this.OpenConnection(this.queueConnection, queue); Apache.NMS.IDestination destination = SessionUtil.GetDestination(this.queueSession, queue.Name); Apache.NMS.IMessageConsumer consumer = this.queueSession.CreateConsumer(destination, selector); return(consumer); }
public Apache.NMS.IMessageProducer CreateProducer(Queue queue) { if (this.queueConnection.IsStarted) { throw new QueueingException("Cannot create producer on an already opened connection. Create new session instead."); } this.OpenConnection(this.queueConnection, queue); Apache.NMS.IDestination destination = SessionUtil.GetDestination(this.queueSession, queue.Name); Apache.NMS.IMessageProducer producer = this.queueSession.CreateProducer(destination); producer.TimeToLive = queue.MessageTimeToLive; return(producer); }
public Apache.NMS.IMessageConsumer CreateConsumer( Apache.NMS.IDestination destination, string selector) { Apache.NMS.XMS.Destination destinationObj = (Apache.NMS.XMS.Destination)destination; try { Apache.NMS.IMessageConsumer consumer = XMSConvert.ToNMSMessageConsumer(this, this.xmsSession.CreateConsumer( destinationObj.xmsDestination, selector)); ConfigureConsumer(consumer); return(consumer); } catch (Exception ex) { ExceptionUtil.WrapAndThrowNMSException(ex); return(null); } }
public Apache.NMS.IMessageProducer CreateProducer( Apache.NMS.IDestination destination) { Apache.NMS.XMS.Destination destinationObj = (Apache.NMS.XMS.Destination)destination; try { Apache.NMS.IMessageProducer producer = XMSConvert.ToNMSMessageProducer(this, this.xmsSession.CreateProducer( destinationObj.xmsDestination)); ConfigureProducer(producer); return(producer); } catch (Exception ex) { ExceptionUtil.WrapAndThrowNMSException(ex); return(null); } }
/// <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.XMS.Destination dest = (Apache.NMS.XMS.Destination)destination; Apache.NMS.XMS.Message msg = GetXMSMessage(message); try { this.xmsMessageProducer.Send( dest.xmsDestination, msg.xmsMessage, XMSConvert.ToJMSDeliveryMode(deliveryMode), (int)priority, (long)timeToLive.TotalMilliseconds); } catch (Exception ex) { ExceptionUtil.WrapAndThrowNMSException(ex); } }