internal MessageConsumer(Session session, ConsumerId id, ActiveMQDestination destination,
String name, String selector, int prefetch, int maxPendingMessageCount,
bool noLocal, bool browser, bool dispatchAsync )
{
if(destination == null)
{
throw new InvalidDestinationException("Consumer cannot receive on Null Destinations.");
}
this.session = session;
this.redeliveryPolicy = this.session.Connection.RedeliveryPolicy;
this.messageTransformation = this.session.Connection.MessageTransformation;
if(session.Connection.MessagePrioritySupported)
{
this.unconsumedMessages = new SimplePriorityMessageDispatchChannel();
}
else
{
this.unconsumedMessages = new FifoMessageDispatchChannel();
}
this.info = new ConsumerInfo();
this.info.ConsumerId = id;
this.info.Destination = destination;
this.info.SubscriptionName = name;
this.info.Selector = selector;
this.info.PrefetchSize = prefetch;
this.info.MaximumPendingMessageLimit = maxPendingMessageCount;
this.info.NoLocal = noLocal;
this.info.Browser = browser;
this.info.DispatchAsync = dispatchAsync;
this.info.Retroactive = session.Retroactive;
this.info.Exclusive = session.Exclusive;
this.info.Priority = session.Priority;
// If the destination contained a URI query, then use it to set public properties
// on the ConsumerInfo
if(destination.Options != null)
{
// Get options prefixed with "consumer.*"
StringDictionary options = URISupport.GetProperties(destination.Options, "consumer.");
// Extract out custom extension options "consumer.nms.*"
StringDictionary customConsumerOptions = URISupport.ExtractProperties(options, "nms.");
URISupport.SetProperties(this.info, options);
URISupport.SetProperties(this, customConsumerOptions, "nms.");
}
}