From df88bce1d160b090232311b59687087082c2c01f Mon Sep 17 00:00:00 2001 From: yuz10 <845238369@qq.com> Date: Mon, 19 Jul 2021 00:05:07 +0800 Subject: [PATCH] add msgTraceEnable config in transaction producer benchmark --- .../example/benchmark/TransactionProducer.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/example/src/main/java/org/apache/rocketmq/example/benchmark/TransactionProducer.java b/example/src/main/java/org/apache/rocketmq/example/benchmark/TransactionProducer.java index 85af04ea..1b511d8a 100644 --- a/example/src/main/java/org/apache/rocketmq/example/benchmark/TransactionProducer.java +++ b/example/src/main/java/org/apache/rocketmq/example/benchmark/TransactionProducer.java @@ -69,6 +69,7 @@ public class TransactionProducer { config.batchId = commandLine.hasOption("b") ? Long.parseLong(commandLine.getOptionValue("b")) : System.currentTimeMillis(); config.sendInterval = commandLine.hasOption("i") ? Integer.parseInt(commandLine.getOptionValue("i")) : 0; config.aclEnable = commandLine.hasOption('a') && Boolean.parseBoolean(commandLine.getOptionValue('a')); + config.msgTraceEnable = commandLine.hasOption('m') && Boolean.parseBoolean(commandLine.getOptionValue('m')); final ExecutorService sendThreadPool = Executors.newFixedThreadPool(config.threadCount); @@ -123,8 +124,12 @@ public class TransactionProducer { }, 10000, 10000); final TransactionListener transactionCheckListener = new TransactionListenerImpl(statsBenchmark, config); - final TransactionMQProducer producer = - new TransactionMQProducer("benchmark_transaction_producer", config.aclEnable ? AclClient.getAclRPCHook() : null); + final TransactionMQProducer producer = new TransactionMQProducer( + null, + "benchmark_transaction_producer", + config.aclEnable ? AclClient.getAclRPCHook() : null, + config.msgTraceEnable, + null); producer.setInstanceName(Long.toString(System.currentTimeMillis())); producer.setTransactionListener(transactionCheckListener); producer.setDefaultTopicQueueNums(1000); @@ -256,6 +261,10 @@ public class TransactionProducer { opt.setRequired(false); options.addOption(opt); + opt = new Option("m", "msgTraceEnable", true, "Message Trace Enable, Default: false"); + opt.setRequired(false); + options.addOption(opt); + return options; } } @@ -439,6 +448,7 @@ class TxSendConfig { long batchId; int sendInterval; boolean aclEnable; + boolean msgTraceEnable; } class LRUMap extends LinkedHashMap { -- GitLab