Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小五666\n哈哈
Rocketmq
提交
36041006
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,发现更多精彩内容 >>
未验证
提交
36041006
编写于
9月 12, 2021
作者:
L
lizhiboo
提交者:
GitHub
9月 12, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ISSUE #3314] Make mqClientApi request timeout settable
上级
564ee290
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
16 addition
and
7 deletion
+16
-7
client/src/main/java/org/apache/rocketmq/client/ClientConfig.java
...rc/main/java/org/apache/rocketmq/client/ClientConfig.java
+10
-1
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
...apache/rocketmq/client/impl/factory/MQClientInstance.java
+6
-6
未找到文件。
client/src/main/java/org/apache/rocketmq/client/ClientConfig.java
浏览文件 @
36041006
...
@@ -60,6 +60,8 @@ public class ClientConfig {
...
@@ -60,6 +60,8 @@ public class ClientConfig {
private
boolean
useTLS
=
TlsSystemConfig
.
tlsEnable
;
private
boolean
useTLS
=
TlsSystemConfig
.
tlsEnable
;
private
int
mqClientApiTimeout
=
3
*
1000
;
private
LanguageCode
language
=
LanguageCode
.
JAVA
;
private
LanguageCode
language
=
LanguageCode
.
JAVA
;
public
String
buildMQClientId
()
{
public
String
buildMQClientId
()
{
...
@@ -298,6 +300,13 @@ public class ClientConfig {
...
@@ -298,6 +300,13 @@ public class ClientConfig {
this
.
accessChannel
=
accessChannel
;
this
.
accessChannel
=
accessChannel
;
}
}
public
int
getMqClientApiTimeout
()
{
return
mqClientApiTimeout
;
}
public
void
setMqClientApiTimeout
(
int
mqClientApiTimeout
)
{
this
.
mqClientApiTimeout
=
mqClientApiTimeout
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
...
@@ -305,6 +314,6 @@ public class ClientConfig {
...
@@ -305,6 +314,6 @@ public class ClientConfig {
+
", clientCallbackExecutorThreads="
+
clientCallbackExecutorThreads
+
", pollNameServerInterval="
+
pollNameServerInterval
+
", clientCallbackExecutorThreads="
+
clientCallbackExecutorThreads
+
", pollNameServerInterval="
+
pollNameServerInterval
+
", heartbeatBrokerInterval="
+
heartbeatBrokerInterval
+
", persistConsumerOffsetInterval="
+
persistConsumerOffsetInterval
+
", heartbeatBrokerInterval="
+
heartbeatBrokerInterval
+
", persistConsumerOffsetInterval="
+
persistConsumerOffsetInterval
+
", pullTimeDelayMillsWhenException="
+
pullTimeDelayMillsWhenException
+
", unitMode="
+
unitMode
+
", unitName="
+
unitName
+
", vipChannelEnabled="
+
", pullTimeDelayMillsWhenException="
+
pullTimeDelayMillsWhenException
+
", unitMode="
+
unitMode
+
", unitName="
+
unitName
+
", vipChannelEnabled="
+
vipChannelEnabled
+
", useTLS="
+
useTLS
+
", language="
+
language
.
name
()
+
", namespace="
+
namespace
+
"]"
;
+
vipChannelEnabled
+
", useTLS="
+
useTLS
+
", language="
+
language
.
name
()
+
", namespace="
+
namespace
+
"
, mqClientApiTimeout="
+
mqClientApiTimeout
+
"
]"
;
}
}
}
}
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
浏览文件 @
36041006
...
@@ -447,7 +447,7 @@ public class MQClientInstance {
...
@@ -447,7 +447,7 @@ public class MQClientInstance {
if
(
addr
!=
null
)
{
if
(
addr
!=
null
)
{
try
{
try
{
this
.
getMQClientAPIImpl
().
checkClientInBroker
(
this
.
getMQClientAPIImpl
().
checkClientInBroker
(
addr
,
entry
.
getKey
(),
this
.
clientId
,
subscriptionData
,
3
*
1000
addr
,
entry
.
getKey
(),
this
.
clientId
,
subscriptionData
,
clientConfig
.
getMqClientApiTimeout
()
);
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
e
instanceof
MQClientException
)
{
if
(
e
instanceof
MQClientException
)
{
...
@@ -554,7 +554,7 @@ public class MQClientInstance {
...
@@ -554,7 +554,7 @@ public class MQClientInstance {
}
}
try
{
try
{
int
version
=
this
.
mQClientAPIImpl
.
sendHearbeat
(
addr
,
heartbeatData
,
3000
);
int
version
=
this
.
mQClientAPIImpl
.
sendHearbeat
(
addr
,
heartbeatData
,
clientConfig
.
getMqClientApiTimeout
()
);
if
(!
this
.
brokerVersionTable
.
containsKey
(
brokerName
))
{
if
(!
this
.
brokerVersionTable
.
containsKey
(
brokerName
))
{
this
.
brokerVersionTable
.
put
(
brokerName
,
new
HashMap
<
String
,
Integer
>(
4
));
this
.
brokerVersionTable
.
put
(
brokerName
,
new
HashMap
<
String
,
Integer
>(
4
));
}
}
...
@@ -610,7 +610,7 @@ public class MQClientInstance {
...
@@ -610,7 +610,7 @@ public class MQClientInstance {
TopicRouteData
topicRouteData
;
TopicRouteData
topicRouteData
;
if
(
isDefault
&&
defaultMQProducer
!=
null
)
{
if
(
isDefault
&&
defaultMQProducer
!=
null
)
{
topicRouteData
=
this
.
mQClientAPIImpl
.
getDefaultTopicRouteInfoFromNameServer
(
defaultMQProducer
.
getCreateTopicKey
(),
topicRouteData
=
this
.
mQClientAPIImpl
.
getDefaultTopicRouteInfoFromNameServer
(
defaultMQProducer
.
getCreateTopicKey
(),
1000
*
3
);
clientConfig
.
getMqClientApiTimeout
()
);
if
(
topicRouteData
!=
null
)
{
if
(
topicRouteData
!=
null
)
{
for
(
QueueData
data
:
topicRouteData
.
getQueueDatas
())
{
for
(
QueueData
data
:
topicRouteData
.
getQueueDatas
())
{
int
queueNums
=
Math
.
min
(
defaultMQProducer
.
getDefaultTopicQueueNums
(),
data
.
getReadQueueNums
());
int
queueNums
=
Math
.
min
(
defaultMQProducer
.
getDefaultTopicQueueNums
(),
data
.
getReadQueueNums
());
...
@@ -619,7 +619,7 @@ public class MQClientInstance {
...
@@ -619,7 +619,7 @@ public class MQClientInstance {
}
}
}
}
}
else
{
}
else
{
topicRouteData
=
this
.
mQClientAPIImpl
.
getTopicRouteInfoFromNameServer
(
topic
,
1000
*
3
);
topicRouteData
=
this
.
mQClientAPIImpl
.
getTopicRouteInfoFromNameServer
(
topic
,
clientConfig
.
getMqClientApiTimeout
()
);
}
}
if
(
topicRouteData
!=
null
)
{
if
(
topicRouteData
!=
null
)
{
TopicRouteData
old
=
this
.
topicRouteTable
.
get
(
topic
);
TopicRouteData
old
=
this
.
topicRouteTable
.
get
(
topic
);
...
@@ -894,7 +894,7 @@ public class MQClientInstance {
...
@@ -894,7 +894,7 @@ public class MQClientInstance {
String
addr
=
entry1
.
getValue
();
String
addr
=
entry1
.
getValue
();
if
(
addr
!=
null
)
{
if
(
addr
!=
null
)
{
try
{
try
{
this
.
mQClientAPIImpl
.
unregisterClient
(
addr
,
this
.
clientId
,
producerGroup
,
consumerGroup
,
3000
);
this
.
mQClientAPIImpl
.
unregisterClient
(
addr
,
this
.
clientId
,
producerGroup
,
consumerGroup
,
clientConfig
.
getMqClientApiTimeout
()
);
log
.
info
(
"unregister client[Producer: {} Consumer: {}] from broker[{} {} {}] success"
,
producerGroup
,
consumerGroup
,
brokerName
,
entry1
.
getKey
(),
addr
);
log
.
info
(
"unregister client[Producer: {} Consumer: {}] from broker[{} {} {}] success"
,
producerGroup
,
consumerGroup
,
brokerName
,
entry1
.
getKey
(),
addr
);
}
catch
(
RemotingException
e
)
{
}
catch
(
RemotingException
e
)
{
log
.
error
(
"unregister client exception from broker: "
+
addr
,
e
);
log
.
error
(
"unregister client exception from broker: "
+
addr
,
e
);
...
@@ -1064,7 +1064,7 @@ public class MQClientInstance {
...
@@ -1064,7 +1064,7 @@ public class MQClientInstance {
if
(
null
!=
brokerAddr
)
{
if
(
null
!=
brokerAddr
)
{
try
{
try
{
return
this
.
mQClientAPIImpl
.
getConsumerIdListByGroup
(
brokerAddr
,
group
,
3000
);
return
this
.
mQClientAPIImpl
.
getConsumerIdListByGroup
(
brokerAddr
,
group
,
clientConfig
.
getMqClientApiTimeout
()
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
warn
(
"getConsumerIdListByGroup exception, "
+
brokerAddr
+
" "
+
group
,
e
);
log
.
warn
(
"getConsumerIdListByGroup exception, "
+
brokerAddr
+
" "
+
group
,
e
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录