Exemple #1
0
                protected virtual ConsumerInfo CreateConsumerInfo(IDestination destination, string selector)
                {
                        ConsumerInfo answer = new ConsumerInfo();
                        ConsumerId id = new ConsumerId();
                        id.ConnectionId = info.SessionId.ConnectionId;
                        id.SessionId = info.SessionId.Value;
                        lock (this)
                        {
                                id.Value = ++consumerCounter;
                        }
                        answer.ConsumerId = id;
                        answer.Destination = ActiveMQDestination.Transform(destination);
                        answer.Selector = selector;
                        answer.PrefetchSize = prefetchSize;
                        answer.Priority = priority;
                        answer.Exclusive = exclusive;
                        answer.DispatchAsync = dispatchAsync;
                        answer.Retroactive = retroactive;

                        // If the destination contained a URI query, then use it to set public properties
                        // on the ConsumerInfo
                        ActiveMQDestination amqDestination = destination as ActiveMQDestination;
                        if (amqDestination != null && amqDestination.Options != null)
                        {
                                Util.URISupport.SetProperties(answer, amqDestination.Options, "consumer.");
                        }

                        return answer;
                }
 // Constructor internal to prevent clients from creating an instance.
 internal MessageConsumer(Session session, ConsumerInfo info, AcknowledgementMode acknowledgementMode)
 {
     this.session = session;
     this.info = info;
     this.acknowledgementMode = acknowledgementMode;
 }