diff --git a/components/org.wso2.micro.integrator.initializer/pom.xml b/components/org.wso2.micro.integrator.initializer/pom.xml
index 9c99de6975..d2d7f4b92d 100755
--- a/components/org.wso2.micro.integrator.initializer/pom.xml
+++ b/components/org.wso2.micro.integrator.initializer/pom.xml
@@ -108,6 +108,10 @@
org.wso2.ei
org.wso2.micro.integrator.observability
+
+ org.wso2.integration.transaction.counter
+ transaction-count-handler
+
diff --git a/components/org.wso2.micro.integrator.initializer/src/main/java/org/wso2/micro/integrator/initializer/ServiceBusInitializer.java b/components/org.wso2.micro.integrator.initializer/src/main/java/org/wso2/micro/integrator/initializer/ServiceBusInitializer.java
index 248f93a02b..30f8ec69ab 100644
--- a/components/org.wso2.micro.integrator.initializer/src/main/java/org/wso2/micro/integrator/initializer/ServiceBusInitializer.java
+++ b/components/org.wso2.micro.integrator.initializer/src/main/java/org/wso2/micro/integrator/initializer/ServiceBusInitializer.java
@@ -50,9 +50,11 @@
import org.osgi.service.component.annotations.ReferencePolicy;
import org.wso2.carbon.inbound.endpoint.EndpointListenerLoader;
import org.wso2.carbon.securevault.SecretCallbackHandlerService;
+import org.wso2.config.mapper.ConfigParser;
import org.wso2.micro.application.deployer.CarbonApplication;
import org.wso2.micro.core.Constants;
import org.wso2.micro.core.ServerShutdownHandler;
+import org.wso2.integration.transaction.counter.TransactionCountHandler;
import org.wso2.micro.integrator.core.services.Axis2ConfigurationContextService;
import org.wso2.micro.integrator.core.services.CarbonServerConfigurationService;
import org.wso2.micro.integrator.core.util.MicroIntegratorBaseUtils;
@@ -81,6 +83,7 @@
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -219,6 +222,11 @@ protected void activate(ComponentContext ctxt) {
synapseEnvironment.registerSynapseHandler(new SynapseExternalPropertyConfigurator());
synapseEnvironment.registerSynapseHandler(new ProxyLogHandler());
+ // Register transaction counter handler
+ if (isTransactionCounterEnabled()) {
+ synapseEnvironment.registerSynapseHandler(new TransactionCountHandler());
+ log.debug("Transaction Count Handler registered");
+ }
if (log.isDebugEnabled()) {
log.debug("SynapseEnvironmentService Registered");
}
@@ -626,4 +634,13 @@ protected void setDatasourceHandlerService(DataSourceService dataSourceService)
protected void unsetDatasourceHandlerService(DataSourceService dataSourceService) {
this.dataSourceService = null;
}
+
+ private boolean isTransactionCounterEnabled() {
+ boolean transactionCounterEnabled = false;
+ Object object = ConfigParser.getParsedConfigs().get("integration.transaction_counter.enable");
+ if (Objects.nonNull(object)) {
+ transactionCounterEnabled = Boolean.parseBoolean(object.toString());
+ }
+ return transactionCounterEnabled;
+ }
}
diff --git a/distribution/src/conf/deployment.toml b/distribution/src/conf/deployment.toml
index b3fe24eba6..0f339eae3f 100644
--- a/distribution/src/conf/deployment.toml
+++ b/distribution/src/conf/deployment.toml
@@ -113,3 +113,19 @@ algorithm = "AES"
# [dashboard_config]
# dashboard_url = "https://localhost:9743/dashboard/api/"
+
+# [integration.transaction_counter]
+# enable = true
+# server_id = "MI_node_1"
+# producer_counting_thread_pool_size = 10
+# producer_scheduled_interval = 10
+# max_transaction_count_per_record = 20
+# min_transaction_count_per_record = 5
+# record_queue_size = 1000
+# publisher_scheduled_interval = 5
+# publisher_max_batch_size = 100
+# publisher_max_retries = 3
+# store_impl = "org.wso2.integration.transaction.counter.store.TransactionRecordStoreImpl"
+# service_url = "https://localhost:8080/transactions/records"
+# service_username = "admin"
+# service_password = "admin"
diff --git a/distribution/src/resources/config-tool/deployment-full.toml b/distribution/src/resources/config-tool/deployment-full.toml
index 7ecc1a91f5..efed1b64bc 100644
--- a/distribution/src/resources/config-tool/deployment-full.toml
+++ b/distribution/src/resources/config-tool/deployment-full.toml
@@ -1098,6 +1098,23 @@ user.password = "pwd-2"
[internal_apis.file_user_store]
enable = false
+#################### Transaction Counter Handler ############################
+[integration.transaction_counter]
+enable = true
+server_id = "MI_node_1"
+producer_counting_thread_pool_size = 10
+producer_scheduled_interval = 10
+max_transaction_count_per_record = 20
+min_transaction_count_per_record = 5
+record_queue_size = 1000
+publisher_scheduled_interval = 5
+publisher_max_batch_size = 100
+publisher_max_retries = 3
+store_impl = "org.wso2.integration.transaction.counter.store.TransactionRecordStoreImpl"
+service_url = "https://localhost:8080/transactions/records"
+service_username = "admin"
+service_password = "admin"
+
#################### Service Catalog #######################################
[[service_catalog]]
apim_host = "https://127.0.0.1:9443"
diff --git a/features/org.wso2.micro.integrator.initializer.feature/pom.xml b/features/org.wso2.micro.integrator.initializer.feature/pom.xml
index 0091de7083..d536d681ab 100644
--- a/features/org.wso2.micro.integrator.initializer.feature/pom.xml
+++ b/features/org.wso2.micro.integrator.initializer.feature/pom.xml
@@ -87,6 +87,9 @@
org.wso2.ei:org.wso2.micro.integrator.transport.handlers:${project.version}
+
+ org.wso2.integration.transaction.counter:transaction-count-handler:${counter.org.wso2.integration.transaction.version}
+
+ 1.0.0
+
1.0.20
[0.0.0, 1.0.0)
[2.6.0, 3.0.0)