[ 
https://issues.apache.org/jira/browse/ARTEMIS-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736876#comment-17736876
 ] 

Davide Rosso commented on ARTEMIS-4326:
---------------------------------------

Well, yes, I wonder if this is the expected behaviour.

You say the the consumer is slow, and that's correct, I actually wanted to see 
what would happen in this case.

But preAck is  in place
{code:java}
ClientSession session = sf.createSession(false, true, true);{code}

so, as slow as the consumer is, when it reads a message form the queue, the 
message is acked, so why there are duplicates ?
And, why the message with keyid = 0, that was the first one read from the queue 
when the consumer was started

{code:java}
Received msg: id = 0 key = DUMMY body = null
Received msg: id = 3322 key = KEY body = null
...
{code}


, is sent again, after more than 100 messages have been read (and acked)  ? 

{code:java}
....
Received msg: id = 3439 key = KEY body = null
****************** DUPLICATE ID :0 key: DUMMY
Received msg: id = 3444 key = KEY body = null
..
{code}




> Redelivery of messages in case of LVQ queue
> -------------------------------------------
>
>                 Key: ARTEMIS-4326
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4326
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.29.0
>            Reporter: Davide Rosso
>            Priority: Critical
>         Attachments: Publisher_UC4.java, Subscriber_UC4_Core.java
>
>
> An address configured as follows:
> {code:java}
>          <address name="uc4">
>             <multicast>
>                <queue name="uc4lvq" last-value-key="keyid" 
> non-destructive="true"/>
>             </multicast>
>             <anycast>
>                 <queue name="uc4queue" />
>             </anycast>
>          </address>{code}
> One producer, one consumer (the use case actually was built to test with 2 
> consumers, one reading from the LVQ queue, the other from the non-LVQ queue, 
> but the issue doesn't depend on the presence of the 2nd consumer).
>  * The producer sends 2 types of messages to the address "uc4"
>  ** 1 message with keyid = "DUMMY" and ID = 0 
>  ** N messages with keyid = "KEY" and ID = 1 to 20.000
>  * The consumer reads from the LVQ queue (uc4lvq); after each message, the 
> consumer sleeps for 10 millisecs. to simulate a "Slow" consumer. The consumer 
> keeps track of duplicate messages and writes the duplicate IDs.
>  * The producer starts and begins sending messages to the address. 
>  * When the producer has sent 2000 messages, the consumer is started.
> I would expect the consumer to
>  * Receive (once) the message with keyid = "DUMMY"
>  * Receive the last message with keyid = "KEY"
>  * Begin receiving the following messages.
> What happens instead is that some messages are redelivered twice; even the 
> message with KEY = "DUMMY", which is the 1st message ever sent to the broker, 
> is redelivered among the other more recent messages
>  
> {code:java}
> Received msg: id = 0 key = DUMMY body = null
> Received msg: id = 3322 key = KEY body = null
> Received msg: id = 3324 key = KEY body = null
> Received msg: id = 3327 key = KEY body = null
> Received msg: id = 3328 key = KEY body = null
> Received msg: id = 3333 key = KEY body = null
> Received msg: id = 3336 key = KEY body = null
> Received msg: id = 3338 key = KEY body = null
> Received msg: id = 3340 key = KEY body = null
> Received msg: id = 3342 key = KEY body = null
> Received msg: id = 3345 key = KEY body = null
> Received msg: id = 3346 key = KEY body = null
> Received msg: id = 3351 key = KEY body = null
> Received msg: id = 3355 key = KEY body = null
> Received msg: id = 3359 key = KEY body = null
> Received msg: id = 3361 key = KEY body = null
> Received msg: id = 3365 key = KEY body = null
> Received msg: id = 3367 key = KEY body = null
> Received msg: id = 3369 key = KEY body = null
> Received msg: id = 3371 key = KEY body = null
> Received msg: id = 3374 key = KEY body = null
> Received msg: id = 3376 key = KEY body = null
> Received msg: id = 3377 key = KEY body = null
> Received msg: id = 3379 key = KEY body = null
> Received msg: id = 3383 key = KEY body = null
> Received msg: id = 3386 key = KEY body = null
> Received msg: id = 3387 key = KEY body = null
> Received msg: id = 3389 key = KEY body = null
> Received msg: id = 3391 key = KEY body = null
> Received msg: id = 3394 key = KEY body = null
> Received msg: id = 3397 key = KEY body = null
> Received msg: id = 3401 key = KEY body = null
> Received msg: id = 3402 key = KEY body = null
> Received msg: id = 3404 key = KEY body = null
> Received msg: id = 3406 key = KEY body = null
> ****************** DUPLICATE ID :3406 key: KEY
> Received msg: id = 3407 key = KEY body = null
> Received msg: id = 3408 key = KEY body = null
> Received msg: id = 3410 key = KEY body = null
> Received msg: id = 3412 key = KEY body = null
> Received msg: id = 3413 key = KEY body = null
> Received msg: id = 3414 key = KEY body = null
> Received msg: id = 3415 key = KEY body = null
> Received msg: id = 3416 key = KEY body = null
> ****************** DUPLICATE ID :3416 key: KEY
> Received msg: id = 3417 key = KEY body = null
> Received msg: id = 3419 key = KEY body = null
> Received msg: id = 3420 key = KEY body = null
> Received msg: id = 3421 key = KEY body = null
> Received msg: id = 3422 key = KEY body = null
> Received msg: id = 3423 key = KEY body = null
> Received msg: id = 3425 key = KEY body = null
> ****************** DUPLICATE ID :3425 key: KEY
> Received msg: id = 3426 key = KEY body = null
> Received msg: id = 3430 key = KEY body = null
> Received msg: id = 3431 key = KEY body = null
> Received msg: id = 3432 key = KEY body = null
> Received msg: id = 3434 key = KEY body = null
> Received msg: id = 3435 key = KEY body = null
> Received msg: id = 3437 key = KEY body = null
> Received msg: id = 3439 key = KEY body = null
> ****************** DUPLICATE ID :0 key: DUMMY
> Received msg: id = 3444 key = KEY body = null
> Received msg: id = 3446 key = KEY body = null
> Received msg: id = 3449 key = KEY body = null
> Received msg: id = 3452 key = KEY body = null
> Received msg: id = 3455 key = KEY body = null
> Received msg: id = 3456 key = KEY body = null
> Received msg: id = 3458 key = KEY body = null
> Received msg: id = 3460 key = KEY body = null
> Received msg: id = 3462 key = KEY body = null
> Received msg: id = 3463 key = KEY body = null
> Received msg: id = 3466 key = KEY body = null
> Received msg: id = 3469 key = KEY body = null
> Received msg: id = 3470 key = KEY body = null
> Received msg: id = 3472 key = KEY body = null
> Received msg: id = 3473 key = KEY body = null
> Received msg: id = 3474 key = KEY body = null
> ****************** DUPLICATE ID :3474 key: KEY
> Received msg: id = 3475 key = KEY body = null
> Received msg: id = 3476 key = KEY body = null
> Received msg: id = 3478 key = KEY body = null
> Received msg: id = 3480 key = KEY body = null
> ...
> {code}
>  
> I attach the two source files used for this test case.
> I tried to write the Subscriber both with JMS and with the Core API, but the 
> result is the same.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to