You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Bala Konakalla (Jira)" <ji...@apache.org> on 2020/02/21 20:08:00 UTC

[jira] [Created] (AMQ-7418) "queuePrefetch" policy doesn't seem to be working properly

Bala Konakalla created AMQ-7418:
-----------------------------------

             Summary: "queuePrefetch" policy doesn't seem to be working properly
                 Key: AMQ-7418
                 URL: https://issues.apache.org/jira/browse/AMQ-7418
             Project: ActiveMQ
          Issue Type: Bug
            Reporter: Bala Konakalla


Hi,

We are using ActiveMQ and MuleSoft in our project. We connect to ActiveMQ from MuleSoft. 

As per the project requirement, we are using JMXGroupId and Queueprefetch polcy.

We have set Queueprefetch to 1 at the connection broker url like below and number of consumers are set to 2

tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1

 

We have two APIs in mule one APIs publishes messages to the queue and another API consumes the messages from the queue. in the receiver API, we have set sleep time to 10secs (for POC to reproduce the issue)

 

2020-02-21 12:42:52,203 [[jms_connectivity_poc]org.mule.api.processor.LoggerMessageProcessor: Written to the queue : 1
2020-02-21 12:42:52,244 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: received : 1
2020-02-21 12:42:53,315 [[jms_connectivity_poc]org.mule.api.processor.LoggerMessageProcessor: Written to the queue : 2
2020-02-21 12:42:53,322 [ActiveMQ Session Task-2] org.mule.api.processor.LoggerMessageProcessor: received : 2
2020-02-21 12:42:57,077 [[jms_connectivity_poc]org.mule.api.processor.LoggerMessageProcessor: Written to the queue : 3
2020-02-21 12:42:58,148 [[jms_connectivity_poc]org.mule.api.processor.LoggerMessageProcessor: Written to the queue : 3
2020-02-21 12:43:01,736 [[jms_connectivity_poc]org.mule.api.processor.LoggerMessageProcessor: Written to the queue : 1
2020-02-21 12:43:02,248 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: success : 1
2020-02-21 12:43:02,257 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: received : 3
2020-02-21 12:43:03,323 [ActiveMQ Session Task-2] org.mule.api.processor.LoggerMessageProcessor: success : 2
2020-02-21 12:43:12,258 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: success : 3
2020-02-21 12:43:12,263 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: received : 3
2020-02-21 12:43:22,264 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: success : 3
2020-02-21 12:43:22,269 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: received : 1
2020-02-21 12:43:32,270 [ActiveMQ Session Task-1] org.mule.api.processor.LoggerMessageProcessor: success : 1

If you see the above log, We have written the messages to the queue in the following sequence:

message 1 with JMXGroupId 1

message 2 with JMXGroupId 2

message 3 with JMXGroupId 3

message 3 with JMXGroupId 3

message 1 with JMXGroupId 1

Since there are two consumer threads, first two messages were picked up by consumer 1 and consumer 2 and If I understand prefetch functionality correctly Message 3 is prefetched to consumer thread 1. 

Even though consumer thread 2 is available after some time, Last Message 1 with JMXgroupId 1, was given thread 1 due to which we are losing the processing time for Message 1.

 

Can you please let me know why Message 1 with JMXgroupId 1 (i.e. Last message) waited for so long and assigned to Thread 1 when Thread 2 is available? do we need to do any changes in the ActiveMQ configuration or any other changes so that it will assign the Message 1 with JMXgGroup 1 to Thread 2?

 

Thanks,

Bala



--
This message was sent by Atlassian Jira
(v8.3.4#803005)