[ 
https://issues.apache.org/activemq/browse/AMQNET-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56476#action_56476
 ] 

Mark Gellings commented on AMQNET-226:
--------------------------------------

I was expecting no prefetch since the consumer was pulling messages manually.

        public static void pullThread()
        {
            var factory = new ConnectionFactory(_uri) { ClientId = 
Environment.MachineName };
            var _listenerConnection2 = factory.CreateConnection(_user, _pass);

            ((Connection)_listenerConnection2).PrefetchPolicy = new 
PrefetchPolicy() { QueuePrefetch = 0 };
            _listenerConnection2.Start();
            Session listenerSession2 = 
(Session)_listenerConnection2.CreateSession(AcknowledgementMode.AutoAcknowledge);
            
            
            IDestination destination2 = new ActiveMQQueue(_queue + 
"?consumer.prefetchSize=5");

            IMessageConsumer consumer2 = 
listenerSession2.CreateConsumer(destination2, "0 = 0", false);

            try
            {

                while (true)
                {
                    IMessage message = 
consumer2.Receive(TimeSpan.FromSeconds(5));
                    if (message != null)
                    {
                        OnMessage2(message);
                    }
                }
            }

            catch (ThreadAbortException)
            {
                if (listenerSession2 != null) listenerSession2.Dispose();
                if (_listenerConnection2 != null) 
_listenerConnection2.Dispose();
                throw;
            }
        }



> ?consumer.prefetchSize=X overrides message consumer in pull mode
> ----------------------------------------------------------------
>
>                 Key: AMQNET-226
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-226
>             Project: ActiveMQ .Net
>          Issue Type: Test
>          Components: NMS
>    Affects Versions: 1.2.0
>         Environment: ActiveMQ 5.2
>            Reporter: Mark Gellings
>            Assignee: Jim Gomes
>             Fix For: 1.2.0
>
>         Attachments: NativeNMSConsumerAndProducer.zip
>
>
> Not sure if this is a bug or more of misconfiguration between broker and NMS. 
>  But if I set the prefetch policy queue prefetch to zero:
> ((Connection)_listenerConnection2).PrefetchPolicy = new PrefetchPolicy() { 
> QueuePrefetch = 0 };
> and configure my destination to prefetch 5:
> IDestination destination2 = new ActiveMQQueue(_queue + 
> "?consumer.prefetchSize=5");
> When _listenerConnection2 pulls it prefetches five messages.  Should the 
> prefetch config on the destination be ignored?
> I've attached a test.  Run a producer and consumer at the same time sending 
> 20 messages.  This will actually run two consumers (one prefetch mode and the 
> other pull mode).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to