Пример #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);
 }
Пример #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);
     }
 }
Пример #3
0
 public NmsProducer CreateSynchronousProducer(Destination destination)
 {
     return new NmsProducer(this, destination, synchronous: true);
 }
Пример #4
0
 public NmsProducer CreateProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return new NmsProducer(this, destination, deliveryMode: messageDeliveryMode);
 }
Пример #5
0
 public NmsProducer CreateProducer(Destination destination)
 {
     return new NmsProducer(this, destination);
 }
Пример #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);
        }
Пример #7
0
 NmsProducer INmsConnection.CreateSynchronousProducer(Destination destination)
 {
     return this.GetConnection().CreateProducer(destination, synchronous: true);
 }
Пример #8
0
 NmsProducer INmsConnection.CreateProducer(Destination destination)
 {
     return new NmsProducer(this, destination);
 }
Пример #9
0
 NmsConsumer INmsConnection.CreateConsumer(Destination destination, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback)
 {
     return new NmsConsumer(this, destination, messageReceivedCallback);
 }
Пример #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);
 }
Пример #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;
        }
Пример #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;
        }
Пример #13
0
 internal NmsProducer(INmsConnection connection, Destination destination, MsgDeliveryMode deliveryMode = MsgDeliveryMode.Persistent, bool synchronous = false)
     : this()
 {
     this.innerDestination = destination;
     this.Setup(connection, deliveryMode, synchronous);
 }
Пример #14
0
 public NmsProducer CreateSynchronousProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return new NmsProducer(this, destination, deliveryMode: messageDeliveryMode, synchronous: true);
 }
Пример #15
0
 public NmsConsumer CreateConsumer(Destination destination, Action<IMessage> messageReceivedCallback, string selector = null)
 {
     return new NmsConsumer(this, destination, messageReceivedCallback, selector);
 }
Пример #16
0
 NmsConsumer INmsConnection.CreateConsumer(Destination destination, Action<IMessage> messageReceivedCallback)
 {
     return new NmsConsumer(this, destination, messageReceivedCallback);
 }
Пример #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);
 }
Пример #18
0
 NmsMultiConsumer INmsConnection.CreateMultiConsumer(Destination destination, int consumerCount, Func<MessageFactory, IMessage, IMessage> messageReceivedCallback)
 {
     return new NmsMultiConsumer(this, destination, consumerCount, messageReceivedCallback);
 }
Пример #19
0
 public NmsMultiConsumer CreateMultiConsumer(Destination destination, int consumerCount, Action<IMessage> messageReceivedCallback)
 {
     return new NmsMultiConsumer(this, destination, consumerCount, messageReceivedCallback);
 }
Пример #20
0
 NmsProducer INmsConnection.CreateProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return new NmsProducer(this, destination, messageDeliveryMode);
 }
Пример #21
0
 public NmsProducer CreateProducer(Destination destination, MsgDeliveryMode messageDeliveryMode = MsgDeliveryMode.Persistent, bool synchronous = false)
 {
     return new NmsProducer(this, destination, messageDeliveryMode, synchronous);
 }
Пример #22
0
 NmsProducer INmsConnection.CreateSynchronousProducer(Destination destination, MsgDeliveryMode messageDeliveryMode)
 {
     return this.GetConnection().CreateProducer(destination, messageDeliveryMode: messageDeliveryMode, synchronous: true);
 }
Пример #23
0
 public void SendRequest(Destination destination, IMessage message)
 {
     this.producer.Send(destination.GetDestination(this.session), message);
 }