[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-dev
Subject:    Re: JMS API with client acknowledgement issue
From:       Justin Bertram <jbertram () apache ! org>
Date:       2023-12-01 17:31:02
Message-ID: CAF+kE=Q3KjhT5V6DGFAnuE5fR7R6ugLBEtcGCTPQjtxooBu7Fw () mail ! gmail ! com
[Download RAW message or body]


FYI - the fix for this issue has been merged. It will be available in
ActiveMQ Artemis 2.32.0.

Thanks again for the report!


Justin

On Thu, Nov 30, 2023 at 11:46 AM Justin Bertram <jbertram@apache.org> wrote:

> I've created ARTEMIS-4520 [1] to deal with this. Thanks for reporting the
> issue!
>
>
> Justin
>
> [1] https://issues.apache.org/jira/browse/ARTEMIS-4520
>
> On Wed, Nov 29, 2023 at 4:08 AM Андрей <x052bb@gmail.com> wrote:
>
>> Hi Team,
>>
>> I am currently using "artemis-jakarta-client" 2.31.2 version
>>
>> I've stumbled into an issue with client acknowledge mode when using JMS
>> API. Here's an example:
>>
>>
>>         try (var factory = new ActiveMQConnectionFactory("<broker-url")) {
>>             try (var ctx = factory.createContext("<user>", "<password>",
>> JMSContext.CLIENT_ACKNOWLEDGE)) {
>>                 var destination = ctx.createQueue("<destination>");
>>                 try (var consumer = ctx.createConsumer(destination)) {
>>                     var message1 = consumer.receive(100000); // suppose
>> this call returns real message
>>                     var message2 = consumer.receive(100000); // suppose
>> this call times out, so NULL is returned
>>                     ctx.acknowledge(); // I'm expecting that message1 gets
>> acknowledged here, but it's not happening
>>
>>                     /*
>>                     Do something here....
>>                      */
>>
>>                 }
>>             }
>>         }
>>
>> The reason for ack not working is that the implementation of
>> "consumer.receive" method stores the latest returned value in JMSContext
>> for future usage in its "acknowledge" method.
>> This happens regardless if the value is null or not. So in case latest
>> call
>> returns null, all the previous messages get lost and never acked.
>>
>> This seem like a defect. Am I right?
>>
>> Thanks in advance
>>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic