Exemple #1
0
 private NmsConsumer(INmsConnection connection, Destination destination, string selector)
 {
     this.id = idCounter++;
     this.selector = selector;
     this.destination = destination;
     this.connection = connection;
     this.connection.ConnectionInterrupted += new EventHandler<NmsConnectionEventArgs>(connection_ConnectionInterrupted);
     this.connection.ConnectionResumed += new EventHandler<NmsConnectionEventArgs>(connection_ConnectionResumed);
 }
Exemple #2
0
 internal NmsMultiConsumer(INmsConnection connection, Destination destination, int consumerCount, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback, string selector = null)
     : this()
 {
     for (int i = 0; i < consumerCount; i++)
     {
         log.Debug("[{2}] Creating consumer #{0} to destination {1}", i, destination, connection.ID);
         var consumer = new NmsConsumer(connection, destination, messageReceivedCallback, selector);
         this.consumers.Add(consumer);
     }
 }
Exemple #3
0
 public NmsProducer CreateSynchronousProducer(Destination destination)
 {
     return new NmsProducer(this, destination, synchronous: true);
 }
Exemple #4
0
 public NmsProducer CreateProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return new NmsProducer(this, destination, deliveryMode: messageDeliveryMode);
 }
Exemple #5
0
 public NmsProducer CreateProducer(Destination destination)
 {
     return new NmsProducer(this, destination);
 }
Exemple #6
0
        public void SendRequest(Destination destination, IMessage message, MsgDeliveryMode deliveryMode, MsgPriority messagePriority, TimeSpan timeToLive)
        {
            if (!this.isInitialized)
                this.asr.WaitOne(10000);

            this.producer.Send(destination.GetDestination(this.session), message, deliveryMode, messagePriority, timeToLive);
        }
Exemple #7
0
 NmsProducer INmsConnection.CreateSynchronousProducer(Destination destination)
 {
     return this.GetConnection().CreateProducer(destination, synchronous: true);
 }
Exemple #8
0
 NmsProducer INmsConnection.CreateProducer(Destination destination)
 {
     return new NmsProducer(this, destination);
 }
Exemple #9
0
 NmsConsumer INmsConnection.CreateConsumer(Destination destination, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback)
 {
     return new NmsConsumer(this, destination, messageReceivedCallback);
 }
Exemple #10
0
 internal NmsConsumer(INmsConnection connection, Destination destination, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback, string selector = null)
     : this(connection, destination, selector)
 {
     this.requestReplyCallback = messageReceivedCallback;
     this.SetupRequestReply(connection, destination, messageReceivedCallback, selector);
 }
Exemple #11
0
        private void SetupRequestReply(INmsConnection connection, Destination destination, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback, string selector = null)
        {
            this.session = connection.GetSession();

            this.consumer = (selector == null)
                ? this.session.CreateConsumer(destination.GetDestination(this.session))
                : session.CreateConsumer(destination.GetDestination(this.session), selector);

            this.consumer.Listener += new MessageListener(this.RequestReplyCallback);

            this.replyProducer = this.session.CreateProducer();
            this.replyProducer.DeliveryMode = MsgDeliveryMode.NonPersistent;

            this.isInitialized = true;
        }
Exemple #12
0
        private void SetupRequestOnly(INmsConnection connection, Destination destination, Action<IMessage> messageReceivedCallback, string selector = null)
        {
            this.session = connection.GetSession();
            this.consumer = (selector == null)
                ? this.session.CreateConsumer(destination.GetDestination(this.session))
                : session.CreateConsumer(destination.GetDestination(this.session), selector);

            this.consumer.Listener += new MessageListener(this.RequestOnlyCallback);

            this.isInitialized = true;
        }
Exemple #13
0
 internal NmsProducer(INmsConnection connection, Destination destination, MsgDeliveryMode deliveryMode = MsgDeliveryMode.Persistent, bool synchronous = false)
     : this()
 {
     this.innerDestination = destination;
     this.Setup(connection, deliveryMode, synchronous);
 }
Exemple #14
0
 public NmsProducer CreateSynchronousProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return new NmsProducer(this, destination, deliveryMode: messageDeliveryMode, synchronous: true);
 }
Exemple #15
0
 public NmsConsumer CreateConsumer(Destination destination, Action<IMessage> messageReceivedCallback, string selector = null)
 {
     return new NmsConsumer(this, destination, messageReceivedCallback, selector);
 }
Exemple #16
0
 NmsConsumer INmsConnection.CreateConsumer(Destination destination, Action<IMessage> messageReceivedCallback)
 {
     return new NmsConsumer(this, destination, messageReceivedCallback);
 }
Exemple #17
0
 public NmsMultiConsumer CreateMultiConsumer(Destination destination, int consumerCount, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback, string selector = null)
 {
     return new NmsMultiConsumer(this, destination, consumerCount, messageReceivedCallback, selector);
 }
Exemple #18
0
 NmsMultiConsumer INmsConnection.CreateMultiConsumer(Destination destination, int consumerCount, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback)
 {
     return new NmsMultiConsumer(this, destination, consumerCount, messageReceivedCallback);
 }
Exemple #19
0
 public NmsMultiConsumer CreateMultiConsumer(Destination destination, int consumerCount, Action<IMessage> messageReceivedCallback)
 {
     return new NmsMultiConsumer(this, destination, consumerCount, messageReceivedCallback);
 }
Exemple #20
0
 NmsProducer INmsConnection.CreateProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return new NmsProducer(this, destination, messageDeliveryMode);
 }
Exemple #21
0
 public NmsProducer CreateProducer(Destination destination, MsgDeliveryMode messageDeliveryMode = MsgDeliveryMode.Persistent, bool synchronous = false)
 {
     return new NmsProducer(this, destination, messageDeliveryMode, synchronous);
 }
Exemple #22
0
 NmsProducer INmsConnection.CreateSynchronousProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return this.GetConnection().CreateProducer(destination, messageDeliveryMode: messageDeliveryMode, synchronous: true);
 }
Exemple #23
0
 public void SendRequest(Destination destination, IMessage message)
 {
     this.producer.Send(destination.GetDestination(this.session), message);
 }