You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ad...@apache.org on 2023/04/17 21:43:56 UTC

[fineract] branch develop updated: FINERACT-1724: Set prefetch message count to 1 for COB

This is an automated email from the ASF dual-hosted git repository.

adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4aa4e77d7 FINERACT-1724: Set prefetch message count to 1 for COB
4aa4e77d7 is described below

commit 4aa4e77d7af09c3fd825dc8735c410eb23486a70
Author: Adam Saghy <ad...@gmail.com>
AuthorDate: Mon Apr 17 19:56:40 2023 +0200

    FINERACT-1724: Set prefetch message count to 1 for COB
---
 .../springbatch/messagehandler/JmsBrokerConfiguration.java           | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/springbatch/messagehandler/JmsBrokerConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/springbatch/messagehandler/JmsBrokerConfiguration.java
index 2e5ef2c8a..ba579b011 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/springbatch/messagehandler/JmsBrokerConfiguration.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/springbatch/messagehandler/JmsBrokerConfiguration.java
@@ -19,6 +19,7 @@
 package org.apache.fineract.infrastructure.springbatch.messagehandler;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQPrefetchPolicy;
 import org.apache.fineract.infrastructure.core.config.FineractProperties;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -31,12 +32,16 @@ public class JmsBrokerConfiguration {
 
     @Autowired
     private FineractProperties fineractProperties;
+    private static final int PREFETCH_MESSAGE_NUMBER = 1;
 
     @Bean
     public ActiveMQConnectionFactory connectionFactory() {
         ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
         connectionFactory.setBrokerURL(fineractProperties.getRemoteJobMessageHandler().getJms().getBrokerUrl());
         connectionFactory.setTrustAllPackages(true);
+        ActiveMQPrefetchPolicy activeMQPrefetchPolicy = new ActiveMQPrefetchPolicy();
+        activeMQPrefetchPolicy.setAll(PREFETCH_MESSAGE_NUMBER);
+        connectionFactory.setPrefetchPolicy(activeMQPrefetchPolicy);
         FineractProperties.FineractRemoteJobMessageHandlerJmsProperties jmsProps = fineractProperties.getRemoteJobMessageHandler().getJms();
         if (jmsProps.isBrokerPasswordProtected()) {
             connectionFactory.setUserName(jmsProps.getBrokerUsername());