Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
Rocketmq
提交
da12c9ed
R
Rocketmq
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
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看板
提交
da12c9ed
编写于
11月 16, 2021
作者:
D
dongeforever
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Correct the invoke for PullMessageProcessor
上级
077cf09d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
34 addition
and
11 deletion
+34
-11
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
...n/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
+17
-2
broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java
...pache/rocketmq/broker/processor/PullMessageProcessor.java
+4
-2
common/src/main/java/org/apache/rocketmq/common/rpc/CommonRpcHeader.java
.../java/org/apache/rocketmq/common/rpc/CommonRpcHeader.java
+10
-0
common/src/main/java/org/apache/rocketmq/common/rpc/RequestBuilder.java
...n/java/org/apache/rocketmq/common/rpc/RequestBuilder.java
+2
-0
common/src/main/java/org/apache/rocketmq/common/rpc/RpcRequest.java
.../main/java/org/apache/rocketmq/common/rpc/RpcRequest.java
+1
-7
未找到文件。
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
浏览文件 @
da12c9ed
...
@@ -54,6 +54,9 @@ import org.apache.rocketmq.common.protocol.header.namesrv.RegisterBrokerRequestH
...
@@ -54,6 +54,9 @@ import org.apache.rocketmq.common.protocol.header.namesrv.RegisterBrokerRequestH
import
org.apache.rocketmq.common.protocol.header.namesrv.RegisterBrokerResponseHeader
;
import
org.apache.rocketmq.common.protocol.header.namesrv.RegisterBrokerResponseHeader
;
import
org.apache.rocketmq.common.protocol.header.namesrv.UnRegisterBrokerRequestHeader
;
import
org.apache.rocketmq.common.protocol.header.namesrv.UnRegisterBrokerRequestHeader
;
import
org.apache.rocketmq.common.protocol.route.TopicRouteData
;
import
org.apache.rocketmq.common.protocol.route.TopicRouteData
;
import
org.apache.rocketmq.common.rpc.ClientMetadata
;
import
org.apache.rocketmq.common.rpc.RpcClient
;
import
org.apache.rocketmq.common.rpc.RpcClientImpl
;
import
org.apache.rocketmq.logging.InternalLogger
;
import
org.apache.rocketmq.logging.InternalLogger
;
import
org.apache.rocketmq.logging.InternalLoggerFactory
;
import
org.apache.rocketmq.logging.InternalLoggerFactory
;
import
org.apache.rocketmq.remoting.InvokeCallback
;
import
org.apache.rocketmq.remoting.InvokeCallback
;
...
@@ -81,15 +84,21 @@ public class BrokerOuterAPI {
...
@@ -81,15 +84,21 @@ public class BrokerOuterAPI {
private
BrokerFixedThreadPoolExecutor
brokerOuterExecutor
=
new
BrokerFixedThreadPoolExecutor
(
4
,
10
,
1
,
TimeUnit
.
MINUTES
,
private
BrokerFixedThreadPoolExecutor
brokerOuterExecutor
=
new
BrokerFixedThreadPoolExecutor
(
4
,
10
,
1
,
TimeUnit
.
MINUTES
,
new
ArrayBlockingQueue
<
Runnable
>(
32
),
new
ThreadFactoryImpl
(
"brokerOutApi_thread_"
,
true
));
new
ArrayBlockingQueue
<
Runnable
>(
32
),
new
ThreadFactoryImpl
(
"brokerOutApi_thread_"
,
true
));
private
ClientMetadata
clientMetadata
;
private
RpcClient
rpcClient
;
public
BrokerOuterAPI
(
final
NettyClientConfig
nettyClientConfig
,
final
BrokerController
brokerController
)
{
public
BrokerOuterAPI
(
final
NettyClientConfig
nettyClientConfig
,
final
BrokerController
brokerController
)
{
this
(
nettyClientConfig
,
null
,
brokerController
);
this
(
nettyClientConfig
,
null
,
brokerController
,
new
ClientMetadata
());
}
}
p
ublic
BrokerOuterAPI
(
final
NettyClientConfig
nettyClientConfig
,
RPCHook
rpcHook
,
final
BrokerController
brokerController
)
{
p
rivate
BrokerOuterAPI
(
final
NettyClientConfig
nettyClientConfig
,
RPCHook
rpcHook
,
final
BrokerController
brokerController
,
ClientMetadata
clientMetadata
)
{
this
.
remotingClient
=
new
NettyRemotingClient
(
nettyClientConfig
);
this
.
remotingClient
=
new
NettyRemotingClient
(
nettyClientConfig
);
this
.
clientMetadata
=
clientMetadata
;
this
.
remotingClient
.
registerRPCHook
(
rpcHook
);
this
.
remotingClient
.
registerRPCHook
(
rpcHook
);
this
.
brokerController
=
brokerController
;
this
.
brokerController
=
brokerController
;
this
.
currBrokerName
=
brokerController
.
getBrokerConfig
().
getBrokerName
();
this
.
currBrokerName
=
brokerController
.
getBrokerConfig
().
getBrokerName
();
this
.
rpcClient
=
new
RpcClientImpl
(
this
.
clientMetadata
,
this
.
remotingClient
);
}
}
public
void
start
()
{
public
void
start
()
{
...
@@ -468,5 +477,11 @@ public class BrokerOuterAPI {
...
@@ -468,5 +477,11 @@ public class BrokerOuterAPI {
}
}
public
ClientMetadata
getClientMetadata
()
{
return
clientMetadata
;
}
public
RpcClient
getRpcClient
()
{
return
rpcClient
;
}
}
}
broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java
浏览文件 @
da12c9ed
...
@@ -144,8 +144,10 @@ public class PullMessageProcessor extends AsyncNettyRequestProcessor implements
...
@@ -144,8 +144,10 @@ public class PullMessageProcessor extends AsyncNettyRequestProcessor implements
}
}
requestHeader
.
setPhysical
(
true
);
requestHeader
.
setPhysical
(
true
);
RpcRequest
rpcRequest
=
new
RpcRequest
(
RequestCode
.
PULL_MESSAGE
,
requestHeader
,
null
);
requestHeader
.
setBname
(
bname
);
RpcResponse
rpcResponse
=
this
.
brokerController
.
getBrokerOuterAPI
().
pullMessage
(
bname
,
rpcRequest
,
this
.
brokerController
.
getBrokerConfig
().
getForwardTimeout
());
requestHeader
.
setCode
(
RequestCode
.
PULL_MESSAGE
);
RpcRequest
rpcRequest
=
new
RpcRequest
(
requestHeader
,
null
);
RpcResponse
rpcResponse
=
this
.
brokerController
.
getBrokerOuterAPI
().
getRpcClient
().
invoke
(
rpcRequest
,
this
.
brokerController
.
getBrokerConfig
().
getForwardTimeout
()).
get
();
if
(
rpcResponse
.
getException
()
!=
null
)
{
if
(
rpcResponse
.
getException
()
!=
null
)
{
throw
rpcResponse
.
getException
();
throw
rpcResponse
.
getException
();
}
}
...
...
common/src/main/java/org/apache/rocketmq/common/rpc/CommonRpcHeader.java
浏览文件 @
da12c9ed
...
@@ -24,6 +24,8 @@ public abstract class CommonRpcHeader implements CommandCustomHeader {
...
@@ -24,6 +24,8 @@ public abstract class CommonRpcHeader implements CommandCustomHeader {
//if the data has been namespaced
//if the data has been namespaced
protected
Boolean
namespaced
;
protected
Boolean
namespaced
;
protected
int
code
;
//the abstract remote addr name, usually the physical broker name
//the abstract remote addr name, usually the physical broker name
protected
String
bname
;
protected
String
bname
;
...
@@ -60,4 +62,12 @@ public abstract class CommonRpcHeader implements CommandCustomHeader {
...
@@ -60,4 +62,12 @@ public abstract class CommonRpcHeader implements CommandCustomHeader {
public
void
setNamespaced
(
Boolean
namespaced
)
{
public
void
setNamespaced
(
Boolean
namespaced
)
{
this
.
namespaced
=
namespaced
;
this
.
namespaced
=
namespaced
;
}
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
}
}
common/src/main/java/org/apache/rocketmq/common/rpc/RequestBuilder.java
浏览文件 @
da12c9ed
...
@@ -25,6 +25,7 @@ public class RequestBuilder {
...
@@ -25,6 +25,7 @@ public class RequestBuilder {
}
}
try
{
try
{
CommonRpcHeader
requestHeader
=
(
CommonRpcHeader
)
requestHeaderClass
.
newInstance
();
CommonRpcHeader
requestHeader
=
(
CommonRpcHeader
)
requestHeaderClass
.
newInstance
();
requestHeader
.
setCode
(
requestCode
);
requestHeader
.
setOneway
(
oneway
);
requestHeader
.
setOneway
(
oneway
);
requestHeader
.
setBname
(
destBrokerName
);
requestHeader
.
setBname
(
destBrokerName
);
return
requestHeader
;
return
requestHeader
;
...
@@ -52,6 +53,7 @@ public class RequestBuilder {
...
@@ -52,6 +53,7 @@ public class RequestBuilder {
}
}
try
{
try
{
TopicQueueRequestHeader
requestHeader
=
(
TopicQueueRequestHeader
)
requestHeaderClass
.
newInstance
();
TopicQueueRequestHeader
requestHeader
=
(
TopicQueueRequestHeader
)
requestHeaderClass
.
newInstance
();
requestHeader
.
setCode
(
requestCode
);
requestHeader
.
setOneway
(
oneway
);
requestHeader
.
setOneway
(
oneway
);
requestHeader
.
setBname
(
destBrokerName
);
requestHeader
.
setBname
(
destBrokerName
);
requestHeader
.
setTopic
(
topic
);
requestHeader
.
setTopic
(
topic
);
...
...
common/src/main/java/org/apache/rocketmq/common/rpc/RpcRequest.java
浏览文件 @
da12c9ed
...
@@ -17,20 +17,14 @@
...
@@ -17,20 +17,14 @@
package
org.apache.rocketmq.common.rpc
;
package
org.apache.rocketmq.common.rpc
;
public
class
RpcRequest
{
public
class
RpcRequest
{
private
int
code
;
private
CommonRpcHeader
header
;
private
CommonRpcHeader
header
;
private
Object
body
;
private
Object
body
;
public
RpcRequest
(
int
code
,
CommonRpcHeader
header
,
Object
body
)
{
public
RpcRequest
(
CommonRpcHeader
header
,
Object
body
)
{
this
.
code
=
code
;
this
.
header
=
header
;
this
.
header
=
header
;
this
.
body
=
body
;
this
.
body
=
body
;
}
}
public
int
getCode
()
{
return
code
;
}
public
CommonRpcHeader
getHeader
()
{
public
CommonRpcHeader
getHeader
()
{
return
header
;
return
header
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录