Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
Rocketmq
提交
08618d51
R
Rocketmq
项目概览
s920243400
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
1
Star
1
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看板
提交
08618d51
编写于
11月 09, 2021
作者:
D
dongeforever
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finish the findBrokerAddr for admin publish subscribe
上级
f308cd30
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
21 deletion
+43
-21
client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java
...cketmq/client/consumer/store/RemoteBrokerOffsetStore.java
+4
-4
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java
...ketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java
+5
-1
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java
...ketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java
+23
-6
client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java
.../apache/rocketmq/client/impl/consumer/PullAPIWrapper.java
+4
-4
client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
...g/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
+4
-3
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
.../rocketmq/client/impl/producer/DefaultMQProducerImpl.java
+3
-3
未找到文件。
client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java
浏览文件 @
08618d51
...
...
@@ -199,10 +199,10 @@ public class RemoteBrokerOffsetStore implements OffsetStore {
@Override
public
void
updateConsumeOffsetToBroker
(
MessageQueue
mq
,
long
offset
,
boolean
isOneway
)
throws
RemotingException
,
MQBrokerException
,
InterruptedException
,
MQClientException
{
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
mq
.
getBrokerName
(
));
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
));
if
(
null
==
findBrokerResult
)
{
this
.
mQClientFactory
.
updateTopicRouteInfoFromNameServer
(
mq
.
getTopic
());
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
mq
.
getBrokerName
(
));
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
));
}
if
(
findBrokerResult
!=
null
)
{
...
...
@@ -226,11 +226,11 @@ public class RemoteBrokerOffsetStore implements OffsetStore {
private
long
fetchConsumeOffsetFromBroker
(
MessageQueue
mq
)
throws
RemotingException
,
MQBrokerException
,
InterruptedException
,
MQClientException
{
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
mq
.
getBrokerName
(
));
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
));
if
(
null
==
findBrokerResult
)
{
this
.
mQClientFactory
.
updateTopicRouteInfoFromNameServer
(
mq
.
getTopic
());
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
mq
.
getBrokerName
(
));
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInAdmin
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
));
}
if
(
findBrokerResult
!=
null
)
{
...
...
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java
浏览文件 @
08618d51
...
...
@@ -578,7 +578,11 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
public
void
sendMessageBack
(
MessageExt
msg
,
int
delayLevel
,
final
String
brokerName
,
String
consumerGroup
)
throws
RemotingException
,
MQBrokerException
,
InterruptedException
,
MQClientException
{
try
{
String
brokerAddr
=
(
null
!=
brokerName
)
?
this
.
mQClientFactory
.
findBrokerAddressInPublish
(
brokerName
)
String
destBrokerName
=
brokerName
;
if
(
MixAll
.
LOGICAL_QUEUE_MOCK_BROKER_NAME
.
equals
(
destBrokerName
))
{
destBrokerName
=
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
this
.
defaultMQPullConsumer
.
queueWithNamespace
(
new
MessageQueue
(
msg
.
getTopic
(),
msg
.
getBrokerName
(),
msg
.
getQueueId
())));
}
String
brokerAddr
=
(
null
!=
destBrokerName
)
?
this
.
mQClientFactory
.
findBrokerAddressInPublish
(
destBrokerName
)
:
RemotingHelper
.
parseSocketAddressAddr
(
msg
.
getStoreHost
());
if
(
UtilAll
.
isBlank
(
consumerGroup
))
{
...
...
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java
浏览文件 @
08618d51
...
...
@@ -725,6 +725,10 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
desBrokerName
=
tmpBrokerName
;
}
}
if
(
MixAll
.
LOGICAL_QUEUE_MOCK_BROKER_NAME
.
equals
(
desBrokerName
))
{
desBrokerName
=
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
this
.
defaultMQPushConsumer
.
queueWithNamespace
(
new
MessageQueue
(
msg
.
getTopic
(),
msg
.
getBrokerName
(),
msg
.
getQueueId
())));
}
String
brokerAddr
=
null
;
if
(
null
!=
desBrokerName
)
{
brokerAddr
=
this
.
mQClientFactory
.
findBrokerAddressInPublish
(
desBrokerName
);
...
...
@@ -765,15 +769,21 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
long
queueOffset
=
ExtraInfoUtil
.
getQueueOffset
(
extraInfoStrs
);
String
topic
=
message
.
getTopic
();
String
desBrokerName
=
brokerName
;
if
(
MixAll
.
LOGICAL_QUEUE_MOCK_BROKER_NAME
.
equals
(
brokerName
))
{
desBrokerName
=
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
this
.
defaultMQPushConsumer
.
queueWithNamespace
(
new
MessageQueue
(
topic
,
brokerName
,
queueId
)));
}
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
b
rokerName
,
MixAll
.
MASTER_ID
,
true
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
desB
rokerName
,
MixAll
.
MASTER_ID
,
true
);
if
(
null
==
findBrokerResult
)
{
this
.
mQClientFactory
.
updateTopicRouteInfoFromNameServer
(
topic
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
b
rokerName
,
MixAll
.
MASTER_ID
,
true
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
desB
rokerName
,
MixAll
.
MASTER_ID
,
true
);
}
if
(
findBrokerResult
==
null
)
{
log
.
error
(
"The broker["
+
b
rokerName
+
"] not exist"
);
log
.
error
(
"The broker["
+
desB
rokerName
+
"] not exist"
);
return
;
}
...
...
@@ -806,11 +816,17 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
String
[]
extraInfoStrs
=
ExtraInfoUtil
.
split
(
extraInfo
);
String
brokerName
=
ExtraInfoUtil
.
getBrokerName
(
extraInfoStrs
);
int
queueId
=
ExtraInfoUtil
.
getQueueId
(
extraInfoStrs
);
String
desBrokerName
=
brokerName
;
if
(
MixAll
.
LOGICAL_QUEUE_MOCK_BROKER_NAME
.
equals
(
brokerName
))
{
desBrokerName
=
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
this
.
defaultMQPushConsumer
.
queueWithNamespace
(
new
MessageQueue
(
topic
,
brokerName
,
queueId
)));
}
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
b
rokerName
,
MixAll
.
MASTER_ID
,
true
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
desB
rokerName
,
MixAll
.
MASTER_ID
,
true
);
if
(
null
==
findBrokerResult
)
{
this
.
mQClientFactory
.
updateTopicRouteInfoFromNameServer
(
topic
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
b
rokerName
,
MixAll
.
MASTER_ID
,
true
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
desB
rokerName
,
MixAll
.
MASTER_ID
,
true
);
}
if
(
findBrokerResult
!=
null
)
{
ChangeInvisibleTimeRequestHeader
requestHeader
=
new
ChangeInvisibleTimeRequestHeader
();
...
...
@@ -820,10 +836,11 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
requestHeader
.
setConsumerGroup
(
consumerGroup
);
requestHeader
.
setExtraInfo
(
extraInfo
);
requestHeader
.
setInvisibleTime
(
invisibleTime
);
//here the broker should be polished
this
.
mQClientFactory
.
getMQClientAPIImpl
().
changeInvisibleTimeAsync
(
brokerName
,
findBrokerResult
.
getBrokerAddr
(),
requestHeader
,
ASYNC_TIMEOUT
,
callback
);
return
;
}
throw
new
MQClientException
(
"The broker["
+
b
rokerName
+
"] not exist"
,
null
);
throw
new
MQClientException
(
"The broker["
+
desB
rokerName
+
"] not exist"
,
null
);
}
public
int
getMaxReconsumeTimes
()
{
...
...
client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java
浏览文件 @
08618d51
...
...
@@ -239,12 +239,12 @@ public class PullAPIWrapper {
int
queueId
=
mq
.
getQueueId
();
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
mq
.
getBrokerName
(
),
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
),
this
.
recalculatePullFromWhichNode
(
mq
),
false
);
if
(
null
==
findBrokerResult
)
{
this
.
mQClientFactory
.
updateTopicRouteInfoFromNameServer
(
topic
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
mq
.
getBrokerName
(
),
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
),
this
.
recalculatePullFromWhichNode
(
mq
),
false
);
}
...
...
@@ -373,10 +373,10 @@ public class PullAPIWrapper {
public
void
popAsync
(
MessageQueue
mq
,
long
invisibleTime
,
int
maxNums
,
String
consumerGroup
,
long
timeout
,
PopCallback
popCallback
,
boolean
poll
,
int
initMode
,
boolean
order
,
String
expressionType
,
String
expression
)
throws
MQClientException
,
RemotingException
,
InterruptedException
{
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
mq
.
getBrokerName
(
),
MixAll
.
MASTER_ID
,
true
);
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
),
MixAll
.
MASTER_ID
,
true
);
if
(
null
==
findBrokerResult
)
{
this
.
mQClientFactory
.
updateTopicRouteInfoFromNameServer
(
mq
.
getTopic
());
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
mq
.
getBrokerName
(
),
MixAll
.
MASTER_ID
,
true
);
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
),
MixAll
.
MASTER_ID
,
true
);
}
if
(
findBrokerResult
!=
null
)
{
PopMessageRequestHeader
requestHeader
=
new
PopMessageRequestHeader
();
...
...
client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
浏览文件 @
08618d51
...
...
@@ -76,7 +76,7 @@ public abstract class RebalanceImpl {
}
public
void
unlock
(
final
MessageQueue
mq
,
final
boolean
oneway
)
{
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
mq
.
getBrokerName
(
),
MixAll
.
MASTER_ID
,
true
);
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
),
MixAll
.
MASTER_ID
,
true
);
if
(
findBrokerResult
!=
null
)
{
UnlockBatchRequestBody
requestBody
=
new
UnlockBatchRequestBody
();
requestBody
.
setConsumerGroup
(
this
.
consumerGroup
);
...
...
@@ -141,7 +141,8 @@ public abstract class RebalanceImpl {
continue
;
}
Set
<
MessageQueue
>
mqs
=
result
.
get
(
mq
.
getBrokerName
());
String
destBrokerName
=
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
);
Set
<
MessageQueue
>
mqs
=
result
.
get
(
destBrokerName
);
if
(
null
==
mqs
)
{
mqs
=
new
HashSet
<
MessageQueue
>();
result
.
put
(
mq
.
getBrokerName
(),
mqs
);
...
...
@@ -154,7 +155,7 @@ public abstract class RebalanceImpl {
}
public
boolean
lock
(
final
MessageQueue
mq
)
{
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
mq
.
getBrokerName
(
),
MixAll
.
MASTER_ID
,
true
);
FindBrokerResult
findBrokerResult
=
this
.
mQClientFactory
.
findBrokerAddressInSubscribe
(
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
),
MixAll
.
MASTER_ID
,
true
);
if
(
findBrokerResult
!=
null
)
{
LockBatchRequestBody
requestBody
=
new
LockBatchRequestBody
();
requestBody
.
setConsumerGroup
(
this
.
consumerGroup
);
...
...
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
浏览文件 @
08618d51
...
...
@@ -721,11 +721,11 @@ public class DefaultMQProducerImpl implements MQProducerInner {
final
TopicPublishInfo
topicPublishInfo
,
final
long
timeout
)
throws
MQClientException
,
RemotingException
,
MQBrokerException
,
InterruptedException
{
long
beginStartTime
=
System
.
currentTimeMillis
();
String
b
rokerName
=
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
);
String
brokerAddr
=
this
.
mQClientFactory
.
findBrokerAddressInPublish
(
b
rokerName
);
String
destB
rokerName
=
this
.
mQClientFactory
.
getBrokerNameFromMessageQueue
(
mq
);
String
brokerAddr
=
this
.
mQClientFactory
.
findBrokerAddressInPublish
(
destB
rokerName
);
if
(
null
==
brokerAddr
)
{
tryToFindTopicPublishInfo
(
mq
.
getTopic
());
brokerAddr
=
this
.
mQClientFactory
.
findBrokerAddressInPublish
(
b
rokerName
);
brokerAddr
=
this
.
mQClientFactory
.
findBrokerAddressInPublish
(
destB
rokerName
);
}
SendMessageContext
context
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录