You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Fengming Lou (JIRA)" <ji...@apache.org> on 2011/05/10 17:32:47 UTC

[jira] [Created] (AMQ-3313) When prefetch size=1 and ack-mode=CLIENT_ACKNOWLEDGE, 2 messages are dispatched to client actually.

When prefetch size=1 and ack-mode=CLIENT_ACKNOWLEDGE, 2 messages are dispatched to client actually.
---------------------------------------------------------------------------------------------------

                 Key: AMQ-3313
                 URL: https://issues.apache.org/jira/browse/AMQ-3313
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.4.2
         Environment: RHEL5/ MAC OS X 10.6.7
            Reporter: Fengming Lou
            Priority: Minor


Setups:
1. use producer/consumer code come with the packaged examples.
2. Send 10 messages to test queue
3. Start up consumer. The consumer is modified to consume 1 messages every 30 seconds.
4. The ackMode is set to CLIENT_ACKNOWLEDGE
5. prefetch size=1 and 4 are tested
6. Monitor and reset queue data through jconsole

Conclusion:

1. For prefetch size=1, broker actually dispatches 2 (1 more than prefetch).
2. For prefetch size=4, broker dispatch exactly 4 messages.

Deatails:

Test prefetch=1

1. Reset queue statistics, my.test (through jconsole)
2. Sent 10 messages to my.test(through jconsole)
3. Start up consumer:

ant consumer -Durl=tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1 -Dmax=10 -Ddurable=false -DtimeToLive=600000 -Dack-mode=CLIENT_ACKNOWLEDGE -Dsubject=my.test

4. monitor consumer logs and jconsole stats.
  The InFlight number was always equal to 2 before 9 messages were consumed.


consumer:

     [echo] Running consumer against server at $url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1 for subject $subject = my.test

     [java] Connecting to URL: tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1

     [java] Consuming queue: my.test

     [java] Using a non-durable subscription

     [java] Running 1 parallel threads

     [java] [Thread-3] We are about to wait until we consume: 10 message(s) then we will shutdown

     [java] [1302639994466 Thread-3] Received: 'Test 1' (length 6)

     [java] [1302640024469 Thread-3] Received: 'Test 2' (length 6)

     [java] [1302640054470 Thread-3] Received: 'Test 3' (length 6)

     [java] [1302640084470 Thread-3] Received: 'Test 4' (length 6)

     [java] [1302640114469 Thread-3] Received: 'Test 5' (length 6)

     [java] [1302640144469 Thread-3] Received: 'Test 6' (length 6)

     [java] [1302640174469 Thread-3] Received: 'Test 7' (length 6)

     [java] [1302640204470 Thread-3] Received: 'Test 8' (length 6)

     [java] [1302640234470 Thread-3] Received: 'Test 9' (length 6)

     [java] [1302640264470 Thread-3] Received: 'Test 10' (length 7)






Above test was repeated for prefetch=4. The Inflight indicates exactly 4 messages were dispatched.


consumer:

     [echo] Running consumer against server at $url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=4 for subject $subject = my.test

     [java] Connecting to URL: tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=4

     [java] Consuming queue: my.test

     [java] Using a non-durable subscription

     [java] Running 1 parallel threads

     [java] [Thread-3] We are about to wait until we consume: 10 message(s) then we will shutdown

     [java] [1302640654692 Thread-3] Received: 'Test 1' (length 6)

     [java] [1302640684694 Thread-3] Received: 'Test 2' (length 6)

  



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (AMQ-3313) When prefetch size=1 and ack-mode=CLIENT_ACKNOWLEDGE, 2 messages are dispatched to client actually.

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish closed AMQ-3313.
-----------------------------

    Resolution: Not A Problem

This is working as designed, if you want to prevent the broker from eagerly dispatching the messages then you need to disable prefetchExtension on the destination policy.

usePrefetchExtension="false"

> When prefetch size=1 and ack-mode=CLIENT_ACKNOWLEDGE, 2 messages are dispatched to client actually.
> ---------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3313
>                 URL: https://issues.apache.org/jira/browse/AMQ-3313
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: RHEL5/ MAC OS X 10.6.7
>            Reporter: Fengming Lou
>            Priority: Minor
>
> Setups:
> 1. use producer/consumer code come with the packaged examples.
> 2. Send 10 messages to test queue
> 3. Start up consumer. The consumer is modified to consume 1 messages every 30 seconds.
> 4. The ackMode is set to CLIENT_ACKNOWLEDGE
> 5. prefetch size=1 and 4 are tested
> 6. Monitor and reset queue data through jconsole
> Conclusion:
> 1. For prefetch size=1, broker actually dispatches 2 (1 more than prefetch).
> 2. For prefetch size=4, broker dispatch exactly 4 messages.
> Deatails:
> Test prefetch=1
> 1. Reset queue statistics, my.test (through jconsole)
> 2. Sent 10 messages to my.test(through jconsole)
> 3. Start up consumer:
> ant consumer -Durl=tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1 -Dmax=10 -Ddurable=false -DtimeToLive=600000 -Dack-mode=CLIENT_ACKNOWLEDGE -Dsubject=my.test
> 4. monitor consumer logs and jconsole stats.
>   The InFlight number was always equal to 2 before 9 messages were consumed.
> consumer:
>      [echo] Running consumer against server at $url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1 for subject $subject = my.test
>      [java] Connecting to URL: tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1
>      [java] Consuming queue: my.test
>      [java] Using a non-durable subscription
>      [java] Running 1 parallel threads
>      [java] [Thread-3] We are about to wait until we consume: 10 message(s) then we will shutdown
>      [java] [1302639994466 Thread-3] Received: 'Test 1' (length 6)
>      [java] [1302640024469 Thread-3] Received: 'Test 2' (length 6)
>      [java] [1302640054470 Thread-3] Received: 'Test 3' (length 6)
>      [java] [1302640084470 Thread-3] Received: 'Test 4' (length 6)
>      [java] [1302640114469 Thread-3] Received: 'Test 5' (length 6)
>      [java] [1302640144469 Thread-3] Received: 'Test 6' (length 6)
>      [java] [1302640174469 Thread-3] Received: 'Test 7' (length 6)
>      [java] [1302640204470 Thread-3] Received: 'Test 8' (length 6)
>      [java] [1302640234470 Thread-3] Received: 'Test 9' (length 6)
>      [java] [1302640264470 Thread-3] Received: 'Test 10' (length 7)
> Above test was repeated for prefetch=4. The Inflight indicates exactly 4 messages were dispatched.
> consumer:
>      [echo] Running consumer against server at $url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=4 for subject $subject = my.test
>      [java] Connecting to URL: tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=4
>      [java] Consuming queue: my.test
>      [java] Using a non-durable subscription
>      [java] Running 1 parallel threads
>      [java] [Thread-3] We are about to wait until we consume: 10 message(s) then we will shutdown
>      [java] [1302640654692 Thread-3] Received: 'Test 1' (length 6)
>      [java] [1302640684694 Thread-3] Received: 'Test 2' (length 6)
>   

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira