Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小五666\n哈哈
Rocketmq
提交
4b7a90a3
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4b7a90a3
编写于
9月 11, 2021
作者:
Y
yuz10
提交者:
GitHub
9月 11, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[#3326] fix send trace fail if useTLS=true (#3325)
上级
b2aa85d3
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
50 addition
and
3 deletion
+50
-3
client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java
...che/rocketmq/client/consumer/DefaultLitePullConsumer.java
+3
-1
client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java
...pache/rocketmq/client/consumer/DefaultMQPushConsumer.java
+9
-1
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java
...rg/apache/rocketmq/client/producer/DefaultMQProducer.java
+8
-0
client/src/test/java/org/apache/rocketmq/client/trace/DefaultMQConsumerWithTraceTest.java
...rocketmq/client/trace/DefaultMQConsumerWithTraceTest.java
+9
-0
client/src/test/java/org/apache/rocketmq/client/trace/DefaultMQLitePullConsumerWithTraceTest.java
.../client/trace/DefaultMQLitePullConsumerWithTraceTest.java
+11
-1
client/src/test/java/org/apache/rocketmq/client/trace/DefaultMQProducerWithTraceTest.java
...rocketmq/client/trace/DefaultMQProducerWithTraceTest.java
+10
-0
未找到文件。
client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java
浏览文件 @
4b7a90a3
...
@@ -535,7 +535,9 @@ public class DefaultLitePullConsumer extends ClientConfig implements LitePullCon
...
@@ -535,7 +535,9 @@ public class DefaultLitePullConsumer extends ClientConfig implements LitePullCon
private
void
setTraceDispatcher
()
{
private
void
setTraceDispatcher
()
{
if
(
isEnableMsgTrace
())
{
if
(
isEnableMsgTrace
())
{
try
{
try
{
this
.
traceDispatcher
=
new
AsyncTraceDispatcher
(
consumerGroup
,
TraceDispatcher
.
Type
.
CONSUME
,
customizedTraceTopic
,
null
);
AsyncTraceDispatcher
traceDispatcher
=
new
AsyncTraceDispatcher
(
consumerGroup
,
TraceDispatcher
.
Type
.
CONSUME
,
customizedTraceTopic
,
null
);
traceDispatcher
.
getTraceProducer
().
setUseTLS
(
this
.
isUseTLS
());
this
.
traceDispatcher
=
traceDispatcher
;
this
.
defaultLitePullConsumerImpl
.
registerConsumeMessageHook
(
this
.
defaultLitePullConsumerImpl
.
registerConsumeMessageHook
(
new
ConsumeMessageTraceHookImpl
(
traceDispatcher
));
new
ConsumeMessageTraceHookImpl
(
traceDispatcher
));
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
...
client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java
浏览文件 @
4b7a90a3
...
@@ -413,6 +413,14 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
...
@@ -413,6 +413,14 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
createTopic
(
key
,
withNamespace
(
newTopic
),
queueNum
,
0
);
createTopic
(
key
,
withNamespace
(
newTopic
),
queueNum
,
0
);
}
}
@Override
public
void
setUseTLS
(
boolean
useTLS
)
{
super
.
setUseTLS
(
useTLS
);
if
(
traceDispatcher
!=
null
&&
traceDispatcher
instanceof
AsyncTraceDispatcher
)
{
((
AsyncTraceDispatcher
)
traceDispatcher
).
getTraceProducer
().
setUseTLS
(
useTLS
);
}
}
/**
/**
* This method will be removed in a certain version after April 5, 2020, so please do not use this method.
* This method will be removed in a certain version after April 5, 2020, so please do not use this method.
*/
*/
...
...
client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java
浏览文件 @
4b7a90a3
...
@@ -263,6 +263,14 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
...
@@ -263,6 +263,14 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
}
}
}
}
@Override
public
void
setUseTLS
(
boolean
useTLS
)
{
super
.
setUseTLS
(
useTLS
);
if
(
traceDispatcher
!=
null
&&
traceDispatcher
instanceof
AsyncTraceDispatcher
)
{
((
AsyncTraceDispatcher
)
traceDispatcher
).
getTraceProducer
().
setUseTLS
(
useTLS
);
}
}
/**
/**
* Start this producer instance. </p>
* Start this producer instance. </p>
*
*
...
...
client/src/test/java/org/apache/rocketmq/client/trace/DefaultMQConsumerWithTraceTest.java
浏览文件 @
4b7a90a3
...
@@ -69,6 +69,7 @@ import org.apache.rocketmq.common.topic.TopicValidator;
...
@@ -69,6 +69,7 @@ import org.apache.rocketmq.common.topic.TopicValidator;
import
org.apache.rocketmq.remoting.RPCHook
;
import
org.apache.rocketmq.remoting.RPCHook
;
import
org.apache.rocketmq.remoting.exception.RemotingException
;
import
org.apache.rocketmq.remoting.exception.RemotingException
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -236,6 +237,14 @@ public class DefaultMQConsumerWithTraceTest {
...
@@ -236,6 +237,14 @@ public class DefaultMQConsumerWithTraceTest {
assertThat
(
msg
.
getBody
()).
isEqualTo
(
new
byte
[]
{
'a'
});
assertThat
(
msg
.
getBody
()).
isEqualTo
(
new
byte
[]
{
'a'
});
}
}
@Test
public
void
testPushConsumerWithTraceTLS
()
{
DefaultMQPushConsumer
consumer
=
new
DefaultMQPushConsumer
(
"consumerGroup"
,
true
);
consumer
.
setUseTLS
(
true
);
AsyncTraceDispatcher
asyncTraceDispatcher
=
(
AsyncTraceDispatcher
)
consumer
.
getTraceDispatcher
();
Assert
.
assertTrue
(
asyncTraceDispatcher
.
getTraceProducer
().
isUseTLS
());
}
private
PullRequest
createPullRequest
()
{
private
PullRequest
createPullRequest
()
{
PullRequest
pullRequest
=
new
PullRequest
();
PullRequest
pullRequest
=
new
PullRequest
();
pullRequest
.
setConsumerGroup
(
consumerGroup
);
pullRequest
.
setConsumerGroup
(
consumerGroup
);
...
...
client/src/test/java/org/apache/rocketmq/client/trace/DefaultMQLitePullConsumerWithTraceTest.java
浏览文件 @
4b7a90a3
...
@@ -52,6 +52,7 @@ import org.apache.rocketmq.common.protocol.route.QueueData;
...
@@ -52,6 +52,7 @@ import org.apache.rocketmq.common.protocol.route.QueueData;
import
org.apache.rocketmq.common.protocol.route.TopicRouteData
;
import
org.apache.rocketmq.common.protocol.route.TopicRouteData
;
import
org.apache.rocketmq.common.topic.TopicValidator
;
import
org.apache.rocketmq.common.topic.TopicValidator
;
import
org.apache.rocketmq.remoting.RPCHook
;
import
org.apache.rocketmq.remoting.RPCHook
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -146,6 +147,15 @@ public class DefaultMQLitePullConsumerWithTraceTest {
...
@@ -146,6 +147,15 @@ public class DefaultMQLitePullConsumerWithTraceTest {
}
}
}
}
@Test
public
void
testLitePullConsumerWithTraceTLS
()
throws
Exception
{
DefaultLitePullConsumer
consumer
=
new
DefaultLitePullConsumer
(
"consumerGroup"
);
consumer
.
setUseTLS
(
true
);
consumer
.
setEnableMsgTrace
(
true
);
consumer
.
start
();
AsyncTraceDispatcher
asyncTraceDispatcher
=
(
AsyncTraceDispatcher
)
consumer
.
getTraceDispatcher
();
Assert
.
assertTrue
(
asyncTraceDispatcher
.
getTraceProducer
().
isUseTLS
());
}
private
DefaultLitePullConsumer
createLitePullConsumerWithDefaultTraceTopic
()
throws
Exception
{
private
DefaultLitePullConsumer
createLitePullConsumerWithDefaultTraceTopic
()
throws
Exception
{
DefaultLitePullConsumer
litePullConsumer
=
new
DefaultLitePullConsumer
(
consumerGroup
+
System
.
currentTimeMillis
());
DefaultLitePullConsumer
litePullConsumer
=
new
DefaultLitePullConsumer
(
consumerGroup
+
System
.
currentTimeMillis
());
...
...
client/src/test/java/org/apache/rocketmq/client/trace/DefaultMQProducerWithTraceTest.java
浏览文件 @
4b7a90a3
...
@@ -39,6 +39,7 @@ import org.apache.rocketmq.common.protocol.route.TopicRouteData;
...
@@ -39,6 +39,7 @@ import org.apache.rocketmq.common.protocol.route.TopicRouteData;
import
org.apache.rocketmq.common.topic.TopicValidator
;
import
org.apache.rocketmq.common.topic.TopicValidator
;
import
org.apache.rocketmq.remoting.exception.RemotingException
;
import
org.apache.rocketmq.remoting.exception.RemotingException
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -143,6 +144,15 @@ public class DefaultMQProducerWithTraceTest {
...
@@ -143,6 +144,15 @@ public class DefaultMQProducerWithTraceTest {
}
}
@Test
public
void
testProducerWithTraceTLS
()
{
DefaultMQProducer
producer
=
new
DefaultMQProducer
(
producerGroupTemp
,
true
);
producer
.
setUseTLS
(
true
);
AsyncTraceDispatcher
asyncTraceDispatcher
=
(
AsyncTraceDispatcher
)
producer
.
getTraceDispatcher
();
Assert
.
assertTrue
(
asyncTraceDispatcher
.
getTraceProducer
().
isUseTLS
());
}
@After
@After
public
void
terminate
()
{
public
void
terminate
()
{
producer
.
shutdown
();
producer
.
shutdown
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录