[ 
https://issues.apache.org/activemq/browse/AMQ-2949?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mathieu Baril updated AMQ-2949:
-------------------------------

    Attachment: activemq-priority-testing.zip

A unit test that demonstrates the behavior describe in the issue.

> Message priority is not always handled correctly
> ------------------------------------------------
>
>                 Key: AMQ-2949
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2949
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.4.1
>            Reporter: Mathieu Baril
>         Attachments: activemq-priority-testing.zip
>
>
> Hi, 
> I'm trying to use ActiveMQ version 5.4.1 with priority. 
> The new features seems to work well when I left the prefetch size of my 
> consumer equal to the default value (1000) but is not working as I'm 
> expecting when I set the prefetch size to 1. 
> Here is the output of the attached unint test when the prefetch size equal to 
> 1000: 
> 2010-09-21 09:37:06,937 - JMS broker started 
> 2010-09-21 09:37:10,087 - Sent 1(P=3) 
> 2010-09-21 09:37:11,111 - Sent 2(P=9) 
> 2010-09-21 09:37:12,140 - Sent 3(P=3) 
> 2010-09-21 09:37:13,162 - Sent 4(P=3) 
> 2010-09-21 09:37:14,189 - Sent 5(P=9) 
> 2010-09-21 09:37:14,194 - Creating message consumer. 
> 2010-09-21 09:37:14,241 - *Consumer's pefetch size=1000*
> 2010-09-21 09:37:14,289 - Received 2(P=9) 
> 2010-09-21 09:37:15,276 - Sent 6(P=3) 
> 2010-09-21 09:37:16,326 - Received 5(P=9) 
> 2010-09-21 09:37:16,333 - Sent 7(P=9) 
> 2010-09-21 09:37:17,354 - Sent 8(P=3) 
> 2010-09-21 09:37:18,332 - Received 7(P=9) 
> 2010-09-21 09:37:18,374 - Sent 9(P=3) 
> 2010-09-21 09:37:19,396 - Sent 10(P=9) 
> 2010-09-21 09:37:20,338 - Received 10(P=9) 
> 2010-09-21 09:37:22,345 - Received 1(P=3) 
> 2010-09-21 09:37:24,351 - Received 3(P=3) 
> 2010-09-21 09:37:26,358 - Received 4(P=3) 
> 2010-09-21 09:37:28,365 - Received 6(P=3) 
> 2010-09-21 09:37:30,371 - Received 8(P=3) 
> 2010-09-21 09:37:32,380 - Received 9(P=3) 
> 2010-09-21 09:37:34,387 - Expected result : [2(P=9), 5(P=9), 7(P=9), 10(P=9), 
> 1(P=3), 3(P=3), 4(P=3), 6(P=3), 8(P=3), 9(P=3)] 
> 2010-09-21 09:37:34,387 - Result : [2(P=9), 5(P=9), 7(P=9), 10(P=9), 1(P=3), 
> 3(P=3), 4(P=3), 6(P=3), 8(P=3), 9(P=3)] 
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 33.851 sec 
> Running the same test with a prefetch value of 1 give me a different result: 
> 2010-09-21 09:39:13,096 - JMS broker started 
> 2010-09-21 09:39:16,293 - Sent 1(P=3) 
> 2010-09-21 09:39:17,338 - Sent 2(P=9) 
> 2010-09-21 09:39:18,368 - Sent 3(P=3) 
> 2010-09-21 09:39:19,413 - Sent 4(P=3) 
> 2010-09-21 09:39:20,443 - Sent 5(P=9) 
> 2010-09-21 09:39:20,443 - Creating message consumer. 
> 2010-09-21 09:39:20,489 - *Consumer's pefetch size=1*
> 2010-09-21 09:39:20,536 - Received 2(P=9) 
> 2010-09-21 09:39:21,511 - Sent 6(P=3) 
> 2010-09-21 09:39:22,550 - Received 5(P=9) 
> 2010-09-21 09:39:22,559 - *Sent 7(P=9)*
> 2010-09-21 09:39:23,620 - Sent 8(P=3) 
> 2010-09-21 09:39:24,587 - *Received 1(P=3)*
> 2010-09-21 09:39:24,650 - Sent 9(P=3) 
> 2010-09-21 09:39:25,640 - Sent 10(P=9) 
> 2010-09-21 09:39:26,590 - *Received 3(P=3) *
> 2010-09-21 09:39:28,567 - *Received 4(P=3) *
> 2010-09-21 09:39:30,574 - Received 7(P=9) 
> 2010-09-21 09:39:32,610 - Received 10(P=9) 
> 2010-09-21 09:39:34,622 - Received 6(P=3) 
> 2010-09-21 09:39:36,634 - Received 8(P=3) 
> 2010-09-21 09:39:38,616 - Received 9(P=3) 
> 2010-09-21 09:39:40,660 - Expected result : [2(P=9), 5(P=9), 7(P=9), 10(P=9), 
> 1(P=3), 3(P=3), 4(P=3), 6(P=3), 8(P=3), 9(P=3)] 
> 2010-09-21 09:39:40,660 - Result : [2(P=9), 5(P=9), 1(P=3), 3(P=3), 4(P=3), 
> 7(P=9), 10(P=9), 6(P=3), 8(P=3), 9(P=3)] 
> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 32.08 sec <<< 
> FAILURE! 
> As you can see, depending of the prefetch value, the message delivery order 
> is not the same. When the prefetch is 1, the message delivery order is not 
> correct (messages 1,3 and 4 are received before message 7). If you look the 
> timestamp, the message 7 is received by the JMS broker before message 1 is 
> sent to the consumer. 
> To run the attached unit test, you need to have maven installed and run the 
> following command: 
> mvn test -DargLine="-DprefetchSize=<prefetch_size_value> 
> -Dactivemq.port=61616" 

-- 
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