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; }
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; }
private void Setup(INmsConnection connection, MsgDeliveryMode deliveryMode, bool synchronous) { this.isSynchronous = synchronous; this.deliveryMode = deliveryMode; this.connection = connection; this.session = connection.GetSession(); this.messageFactory = new MessageFactory(this.session.InnerSession); this.connection.ConnectionInterrupted += new EventHandler<NmsConnectionEventArgs>(connection_ConnectionInterrupted); this.connection.ConnectionResumed += new EventHandler<NmsConnectionEventArgs>(connection_ConnectionResumed); if (this.innerDestination == null) { this.producer = this.session.CreateProducer(); } else { this.destination = this.innerDestination.GetDestination(this.session); this.producer = this.session.CreateProducer(this.destination); } this.producer.DeliveryMode = deliveryMode; if (synchronous) this.InitializeForSynchronous(); this.isInitialized = true; this.asr.Set(); }