zongtanghu commented on a change in pull request #2598:
URL: https://github.com/apache/rocketmq/pull/2598#discussion_r625516217
##########
File path:
client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java
##########
@@ -182,17 +194,68 @@ public DefaultLitePullConsumer(RPCHook rpcHook) {
* Constructor specifying consumer group, RPC hook
*
* @param consumerGroup Consumer group.
- * @param rpcHook RPC hook to execute before each remoting command.
+ * @param rpcHook RPC hook to execute before each remoting command.
*/
public DefaultLitePullConsumer(final String consumerGroup, RPCHook
rpcHook) {
this(null, consumerGroup, rpcHook);
}
+ /**
+ * Constructor specifying consumer group and enabled msg trace flag.
+ *
+ * @param consumerGroup Consumer group.
+ * @param enableMsgTrace Switch flag instance for message trace.
+ */
+ public DefaultLitePullConsumer(final String consumerGroup, boolean
enableMsgTrace) {
+ this(null, consumerGroup, null, enableMsgTrace, null);
+ }
+
+ /**
+ * Constructor specifying consumer group, enabled msg trace flag and
customized trace topic name.
+ *
+ * @param consumerGroup Consumer group.
+ * @param enableMsgTrace Switch flag instance for message trace.
+ * @param customizedTraceTopic The name value of message trace topic.If
you don't config,you can use the default
+ * trace topic name.
+ */
+ public DefaultLitePullConsumer(final String consumerGroup, boolean
enableMsgTrace,
+ final String customizedTraceTopic) {
+ this(null, consumerGroup, null, enableMsgTrace, customizedTraceTopic);
+ }
+
+ /**
+ * Constructor specifying namespace, consumer group, RPC hook, enabled msg
trace flag and customized trace topic
+ * name.
+ *
+ * @param namespace Namespace for this MQ Producer instance.
+ * @param consumerGroup Consume queue.
+ * @param rpcHook RPC hook to execute before each remoting
command.
+ * @param enableMsgTrace Switch flag instance for message trace.
+ * @param customizedTraceTopic The name value of message trace topic.If
you don't config,you can use the default
+ * trace topic name.
+ */
+ public DefaultLitePullConsumer(final String namespace, final String
consumerGroup, RPCHook rpcHook,
+ boolean enableMsgTrace, final String customizedTraceTopic) {
+ this.namespace = namespace;
+ this.consumerGroup = consumerGroup;
+ defaultLitePullConsumerImpl = new DefaultLitePullConsumerImpl(this,
rpcHook);
+ if (enableMsgTrace) {
+ try {
+ AsyncTraceDispatcher dispatcher = new
AsyncTraceDispatcher(consumerGroup, TraceDispatcher.Type.CONSUME,
customizedTraceTopic, rpcHook);
+ traceDispatcher = dispatcher;
Review comment:
Here, there are two points keys:
firstly, you can add this keywords, such as, this.traceDispatcher ;
secondly, the dispatcher object is redunctant, you can initial the object
instance directly, such as, this.traceDispatcher = new
AsyncTraceDispatcher(consumerGroup, TraceDispatcher.Type.CONSUME,
customizedTraceTopic, rpcHook);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]