Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小五666\n哈哈
Rocketmq
提交
94525752
R
Rocketmq
项目概览
小五666\n哈哈
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rocketmq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
94525752
编写于
12月 29, 2018
作者:
D
dongeforever
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refine the interface for msg_trace
上级
10d84bbe
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
20 deletion
+42
-20
client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java
...pache/rocketmq/client/consumer/DefaultMQPushConsumer.java
+20
-9
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java
...rg/apache/rocketmq/client/producer/DefaultMQProducer.java
+20
-9
example/src/main/java/org/apache/rocketmq/example/tracemessage/TraceProducer.java
...g/apache/rocketmq/example/tracemessage/TraceProducer.java
+1
-1
example/src/main/java/org/apache/rocketmq/example/tracemessage/TracePushConsumer.java
...ache/rocketmq/example/tracemessage/TracePushConsumer.java
+1
-1
未找到文件。
client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java
浏览文件 @
94525752
...
...
@@ -285,17 +285,17 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
* @param consumerGroup Consume queue.
* @param rpcHook RPC hook to execute before each remoting command.
* @param allocateMessageQueueStrategy message queue allocating algorithm.
* @param
msgTraceSwitch
switch flag instance for message trace.
* @param
traceTopicName
the name value of message trace topic.If you don't config,you can use the default trace topic name.
* @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
DefaultMQPushConsumer
(
final
String
consumerGroup
,
RPCHook
rpcHook
,
AllocateMessageQueueStrategy
allocateMessageQueueStrategy
,
boolean
msgTraceSwitch
,
final
String
traceTopicName
)
{
AllocateMessageQueueStrategy
allocateMessageQueueStrategy
,
boolean
enableMsgTrace
,
final
String
customizedTraceTopic
)
{
this
.
consumerGroup
=
consumerGroup
;
this
.
allocateMessageQueueStrategy
=
allocateMessageQueueStrategy
;
defaultMQPushConsumerImpl
=
new
DefaultMQPushConsumerImpl
(
this
,
rpcHook
);
if
(
msgTraceSwitch
)
{
if
(
enableMsgTrace
)
{
try
{
AsyncTraceDispatcher
dispatcher
=
new
AsyncTraceDispatcher
(
traceTopicName
,
rpcHook
);
AsyncTraceDispatcher
dispatcher
=
new
AsyncTraceDispatcher
(
customizedTraceTopic
,
rpcHook
);
dispatcher
.
setHostConsumer
(
this
.
getDefaultMQPushConsumerImpl
());
traceDispatcher
=
dispatcher
;
this
.
getDefaultMQPushConsumerImpl
().
registerConsumeMessageHook
(
...
...
@@ -315,15 +315,26 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
this
(
MixAll
.
DEFAULT_CONSUMER_GROUP
,
rpcHook
,
new
AllocateMessageQueueAveragely
());
}
/**
* Constructor specifying consumer group.
*
* @param consumerGroup Consumer group.
* @param enableMsgTrace switch flag instance for message trace.
*/
public
DefaultMQPushConsumer
(
final
String
consumerGroup
,
boolean
enableMsgTrace
)
{
this
(
consumerGroup
,
null
,
new
AllocateMessageQueueAveragely
(),
enableMsgTrace
,
null
);
}
/**
* Constructor specifying consumer group.
*
* @param consumerGroup Consumer group.
* @param
msgTraceSwitch
switch flag instance for message trace.
* @param
traceTopicName
the name value of message trace topic.If you don't config,you can use the default trace topic name.
* @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
DefaultMQPushConsumer
(
final
String
consumerGroup
,
boolean
msgTraceSwitch
,
final
String
traceTopicName
)
{
this
(
consumerGroup
,
null
,
new
AllocateMessageQueueAveragely
(),
msgTraceSwitch
,
traceTopicName
);
public
DefaultMQPushConsumer
(
final
String
consumerGroup
,
boolean
enableMsgTrace
,
final
String
customizedTraceTopic
)
{
this
(
consumerGroup
,
null
,
new
AllocateMessageQueueAveragely
(),
enableMsgTrace
,
customizedTraceTopic
);
}
/**
...
...
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java
浏览文件 @
94525752
...
...
@@ -154,16 +154,16 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
*
* @param producerGroup Producer group, see the name-sake field.
* @param rpcHook RPC hook to execute per each remoting command execution.
* @param
msgTraceSwitch
switch flag instance for message trace.
* @param
traceTopicName
the name value of message trace topic.If you don't config,you can use the default trace topic name.
* @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
DefaultMQProducer
(
final
String
producerGroup
,
RPCHook
rpcHook
,
boolean
msgTraceSwitch
,
final
String
traceTopicName
)
{
public
DefaultMQProducer
(
final
String
producerGroup
,
RPCHook
rpcHook
,
boolean
enableMsgTrace
,
final
String
customizedTraceTopic
)
{
this
.
producerGroup
=
producerGroup
;
defaultMQProducerImpl
=
new
DefaultMQProducerImpl
(
this
,
rpcHook
);
//if client open the message trace feature
if
(
msgTraceSwitch
)
{
if
(
enableMsgTrace
)
{
try
{
AsyncTraceDispatcher
dispatcher
=
new
AsyncTraceDispatcher
(
traceTopicName
,
rpcHook
);
AsyncTraceDispatcher
dispatcher
=
new
AsyncTraceDispatcher
(
customizedTraceTopic
,
rpcHook
);
dispatcher
.
setHostProducer
(
this
.
getDefaultMQProducerImpl
());
traceDispatcher
=
dispatcher
;
this
.
getDefaultMQProducerImpl
().
registerSendMessageHook
(
...
...
@@ -187,11 +187,22 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* Constructor specifying producer group.
*
* @param producerGroup Producer group, see the name-sake field.
* @param msgTraceSwitch switch flag instance for message trace.
* @param traceTopicName the name value of message trace topic.If you don't config,you can use the default trace topic name.
* @param enableMsgTrace switch flag instance for message trace.
*/
public
DefaultMQProducer
(
final
String
producerGroup
,
boolean
msgTraceSwitch
,
final
String
traceTopicName
)
{
this
(
producerGroup
,
null
,
msgTraceSwitch
,
traceTopicName
);
public
DefaultMQProducer
(
final
String
producerGroup
,
boolean
enableMsgTrace
)
{
this
(
producerGroup
,
null
,
enableMsgTrace
,
null
);
}
/**
* Constructor specifying producer group.
*
* @param producerGroup Producer group, see the name-sake field.
* @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
DefaultMQProducer
(
final
String
producerGroup
,
boolean
enableMsgTrace
,
final
String
customizedTraceTopic
)
{
this
(
producerGroup
,
null
,
enableMsgTrace
,
customizedTraceTopic
);
}
/**
...
...
example/src/main/java/org/apache/rocketmq/example/tracemessage/TraceProducer.java
浏览文件 @
94525752
...
...
@@ -26,7 +26,7 @@ import org.apache.rocketmq.remoting.common.RemotingHelper;
public
class
TraceProducer
{
public
static
void
main
(
String
[]
args
)
throws
MQClientException
,
InterruptedException
{
DefaultMQProducer
producer
=
new
DefaultMQProducer
(
"ProducerGroupName"
,
true
,
""
);
DefaultMQProducer
producer
=
new
DefaultMQProducer
(
"ProducerGroupName"
,
true
);
producer
.
start
();
for
(
int
i
=
0
;
i
<
128
;
i
++)
...
...
example/src/main/java/org/apache/rocketmq/example/tracemessage/TracePushConsumer.java
浏览文件 @
94525752
...
...
@@ -29,7 +29,7 @@ import org.apache.rocketmq.common.message.MessageExt;
public
class
TracePushConsumer
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
,
MQClientException
{
//here,we use the default message track trace topic name
DefaultMQPushConsumer
consumer
=
new
DefaultMQPushConsumer
(
"CID_JODIE_1"
,
true
,
""
);
DefaultMQPushConsumer
consumer
=
new
DefaultMQPushConsumer
(
"CID_JODIE_1"
,
true
);
consumer
.
subscribe
(
"TopicTest"
,
"*"
);
consumer
.
setConsumeFromWhere
(
ConsumeFromWhere
.
CONSUME_FROM_FIRST_OFFSET
);
//wrong time format 2017_0422_221800
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录