/// <summary> /// Callers must hold the failover mutex before calling this method. /// </summary> /// <param name="consumer"></param> private void RegisterConsumer(BasicMessageConsumer consumer) { // Need to generate a consumer tag on the client so we can exploit the nowait flag. String tag = string.Format("{0}-{1}", _sessionNumber, _nextConsumerNumber++); consumer.ConsumerTag = tag; _consumers.Add(tag, consumer); String consumerTag = ConsumeFromQueue(consumer.QueueName, consumer.NoLocal, consumer.Exclusive, consumer.AcknowledgeMode, tag, consumer.Browse); }
/// <summary> Creates a message consumer on this channel.</summary> /// /// <param name="queueName">The name of the queue to attach the consumer to.</param> /// <param name="prefetchLow">The pre-fetch buffer low-water mark.</param> /// <param name="prefetchHigh">The pre-fetch buffer high-water mark.</param> /// <param name="noLocal">The no-local flag, <tt>true</tt> means that the consumer does not receive messages sent on this channel.</param> /// <param name="exclusive">The exclusive flag, <tt>true</tt> gives this consumer exclusive receive access to the queue.</param> /// /// <return>The message consumer.</return> private IMessageConsumer CreateConsumerImpl(string queueName, int prefetchLow, int prefetchHigh, bool noLocal, bool exclusive, bool browse) { lock (_closingLock) { CheckNotClosed(); BasicMessageConsumer consumer = new BasicMessageConsumer(_channelId, queueName, noLocal, _messageFactoryRegistry, this, prefetchHigh, prefetchLow, exclusive, browse); try { RegisterConsumer(consumer); } catch (AMQException e) { throw new QpidException("Error registering consumer: " + e, e); } return consumer; } }