Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
檀越@新空间
Rocketmq
提交
82f53573
R
Rocketmq
项目概览
檀越@新空间
/
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看板
提交
82f53573
编写于
1月 28, 2019
作者:
D
duhenglucky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify unit test
上级
94dc4427
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
19 addition
and
36 deletion
+19
-36
acl/src/test/java/org/apache/rocketmq/acl/plain/PlainAccessValidatorTest.java
...g/apache/rocketmq/acl/plain/PlainAccessValidatorTest.java
+1
-0
acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionLoaderTest.java
.../apache/rocketmq/acl/plain/PlainPermissionLoaderTest.java
+0
-2
distribution/conf/flowControl.yml
distribution/conf/flowControl.yml
+1
-1
snode/src/main/java/org/apache/rocketmq/snode/service/EnodeService.java
.../java/org/apache/rocketmq/snode/service/EnodeService.java
+1
-4
snode/src/main/java/org/apache/rocketmq/snode/service/PushService.java
...n/java/org/apache/rocketmq/snode/service/PushService.java
+9
-1
snode/src/main/java/org/apache/rocketmq/snode/service/impl/EnodeServiceImpl.java
.../apache/rocketmq/snode/service/impl/EnodeServiceImpl.java
+1
-24
snode/src/main/java/org/apache/rocketmq/snode/service/impl/PushServiceImpl.java
...g/apache/rocketmq/snode/service/impl/PushServiceImpl.java
+2
-2
snode/src/main/java/org/apache/rocketmq/snode/service/impl/ScheduledServiceImpl.java
...che/rocketmq/snode/service/impl/ScheduledServiceImpl.java
+1
-1
snode/src/test/java/org/apache/rocketmq/snode/SnodeControllerTest.java
...t/java/org/apache/rocketmq/snode/SnodeControllerTest.java
+3
-1
未找到文件。
acl/src/test/java/org/apache/rocketmq/acl/plain/PlainAccessValidatorTest.java
浏览文件 @
82f53573
...
...
@@ -44,6 +44,7 @@ public class PlainAccessValidatorTest {
@Before
public
void
init
()
{
System
.
setProperty
(
"rocketmq.home.dir"
,
"src/test/resources"
);
System
.
setProperty
(
"rocketmq.acl.plain.file"
,
"/conf/plain_acl.yml"
);
plainAccessValidator
=
new
PlainAccessValidator
();
sessionCredentials
=
new
SessionCredentials
();
sessionCredentials
.
setAccessKey
(
"RocketMQ"
);
...
...
acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionLoaderTest.java
浏览文件 @
82f53573
...
...
@@ -28,7 +28,6 @@ import org.apache.commons.lang3.reflect.FieldUtils;
import
org.apache.rocketmq.acl.common.AclException
;
import
org.apache.rocketmq.acl.common.Permission
;
import
org.apache.rocketmq.acl.plain.PlainPermissionLoader.PlainAccessConfig
;
import
org.apache.rocketmq.common.UtilAll
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
...
...
@@ -269,7 +268,6 @@ public class PlainPermissionLoaderTest {
public
void
initializeTest
()
{
System
.
setProperty
(
"rocketmq.acl.plain.file"
,
"/conf/plain_acl_null.yml"
);
new
PlainPermissionLoader
();
}
}
distribution/conf/flowControl.yml
浏览文件 @
82f53573
snode
:
countLimit
:
#
f
low control type, only requestCount & requestSize support
countLimit
:
#
F
low control type, only requestCount & requestSize support
-
flowControlResourceName
:
310
flowControlGrade
:
1
flowControlBehavior
:
1
...
...
snode/src/main/java/org/apache/rocketmq/snode/service/EnodeService.java
浏览文件 @
82f53573
...
...
@@ -20,7 +20,6 @@ import java.util.concurrent.CompletableFuture;
import
org.apache.rocketmq.client.exception.MQBrokerException
;
import
org.apache.rocketmq.common.TopicConfig
;
import
org.apache.rocketmq.common.subscription.SubscriptionGroupConfig
;
import
org.apache.rocketmq.remoting.RemotingChannel
;
import
org.apache.rocketmq.remoting.exception.RemotingCommandException
;
import
org.apache.rocketmq.remoting.exception.RemotingConnectException
;
import
org.apache.rocketmq.remoting.exception.RemotingSendRequestException
;
...
...
@@ -34,12 +33,10 @@ public interface EnodeService {
CompletableFuture
<
RemotingCommand
>
pullMessage
(
final
String
enodeName
,
final
RemotingCommand
request
);
void
notifyConsumerIdsChanged
(
final
RemotingChannel
channel
,
final
String
consumerGroup
);
RemotingCommand
creatTopic
(
String
enodeName
,
TopicConfig
topicConfig
)
throws
InterruptedException
,
RemotingTimeoutException
,
RemotingSendRequestException
,
RemotingConnectException
;
void
updateEnodeAddr
(
String
clusterName
)
throws
InterruptedException
,
RemotingTimeoutException
,
void
updateEnodeAddr
ess
(
String
clusterName
)
throws
InterruptedException
,
RemotingTimeoutException
,
RemotingSendRequestException
,
RemotingConnectException
,
MQBrokerException
;
boolean
persistSubscriptionGroupConfig
(
SubscriptionGroupConfig
subscriptionGroupConfig
);
...
...
snode/src/main/java/org/apache/rocketmq/snode/service/PushService.java
浏览文件 @
82f53573
...
...
@@ -19,7 +19,15 @@ package org.apache.rocketmq.snode.service;
import
org.apache.rocketmq.remoting.protocol.RemotingCommand
;
public
interface
PushService
{
/**
* TODO how to resolve the slow consumer: close or ignore?
*
* @param enodeName
* @param topic
* @param queueId
* @param message
* @param response
*/
void
pushMessage
(
final
String
enodeName
,
final
String
topic
,
final
Integer
queueId
,
final
byte
[]
message
,
final
RemotingCommand
response
);
...
...
snode/src/main/java/org/apache/rocketmq/snode/service/impl/EnodeServiceImpl.java
浏览文件 @
82f53573
...
...
@@ -31,14 +31,12 @@ import org.apache.rocketmq.common.protocol.ResponseCode;
import
org.apache.rocketmq.common.protocol.body.ClusterInfo
;
import
org.apache.rocketmq.common.protocol.header.CreateTopicRequestHeader
;
import
org.apache.rocketmq.common.protocol.header.GetMinOffsetRequestHeader
;
import
org.apache.rocketmq.common.protocol.header.NotifyConsumerIdsChangedRequestHeader
;
import
org.apache.rocketmq.common.protocol.header.QueryConsumerOffsetRequestHeader
;
import
org.apache.rocketmq.common.protocol.header.UpdateConsumerOffsetRequestHeader
;
import
org.apache.rocketmq.common.subscription.SubscriptionGroupConfig
;
import
org.apache.rocketmq.logging.InternalLogger
;
import
org.apache.rocketmq.logging.InternalLoggerFactory
;
import
org.apache.rocketmq.remoting.InvokeCallback
;
import
org.apache.rocketmq.remoting.RemotingChannel
;
import
org.apache.rocketmq.remoting.exception.RemotingCommandException
;
import
org.apache.rocketmq.remoting.exception.RemotingConnectException
;
import
org.apache.rocketmq.remoting.exception.RemotingSendRequestException
;
...
...
@@ -121,27 +119,6 @@ public class EnodeServiceImpl implements EnodeService {
return
future
;
}
@Override
public
void
notifyConsumerIdsChanged
(
final
RemotingChannel
channel
,
final
String
consumerGroup
)
{
if
(
null
==
consumerGroup
)
{
log
.
error
(
"NotifyConsumerIdsChanged consumerGroup is null"
);
return
;
}
NotifyConsumerIdsChangedRequestHeader
requestHeader
=
new
NotifyConsumerIdsChangedRequestHeader
();
requestHeader
.
setConsumerGroup
(
consumerGroup
);
RemotingCommand
request
=
RemotingCommand
.
createRequestCommand
(
RequestCode
.
NOTIFY_CONSUMER_IDS_CHANGED
,
requestHeader
);
try
{
this
.
snodeController
.
getSnodeServer
().
invokeOneway
(
channel
,
request
,
SnodeConstant
.
ONE_WAY_TIMEOUT
);
}
catch
(
Exception
e
)
{
log
.
error
(
"NotifyConsumerIdsChanged consumer group: {} exception "
,
consumerGroup
,
e
);
}
}
private
ClusterInfo
getBrokerClusterInfo
(
final
long
timeoutMillis
)
throws
InterruptedException
,
RemotingTimeoutException
,
RemotingSendRequestException
,
RemotingConnectException
,
MQBrokerException
{
...
...
@@ -158,7 +135,7 @@ public class EnodeServiceImpl implements EnodeService {
}
@Override
public
void
updateEnodeAddr
(
String
clusterName
)
throws
InterruptedException
,
RemotingTimeoutException
,
public
void
updateEnodeAddr
ess
(
String
clusterName
)
throws
InterruptedException
,
RemotingTimeoutException
,
RemotingSendRequestException
,
RemotingConnectException
,
MQBrokerException
{
synchronized
(
this
)
{
ClusterInfo
clusterInfo
=
getBrokerClusterInfo
(
SnodeConstant
.
DEFAULT_TIMEOUT_MILLS
);
...
...
snode/src/main/java/org/apache/rocketmq/snode/service/impl/PushServiceImpl.java
浏览文件 @
82f53573
...
...
@@ -104,8 +104,8 @@ public class PushServiceImpl implements PushService {
if
(
subscription
.
getSubscriptionData
(
topic
)
!=
null
)
{
boolean
slowConsumer
=
snodeController
.
getSlowConsumerService
().
isSlowConsumer
(
sendMessageResponseHeader
.
getQueueOffset
(),
topic
,
queueId
,
consumerGroup
,
enodeName
);
if
(
slowConsumer
)
{
log
.
warn
(
"[SlowConsumer]: {} closed as slow consumer"
,
remotingChannel
);
//TODO metrics
remotingChannel
.
close
();
//FIXME this action should be discussed
log
.
warn
(
"[SlowConsumer]: {} closed as slow consumer"
,
remotingChannel
);
remotingChannel
.
close
();
continue
;
}
snodeController
.
getSnodeServer
().
push
(
remotingChannel
,
pushMessage
,
SnodeConstant
.
DEFAULT_TIMEOUT_MILLS
);
...
...
snode/src/main/java/org/apache/rocketmq/snode/service/impl/ScheduledServiceImpl.java
浏览文件 @
82f53573
...
...
@@ -96,7 +96,7 @@ public class ScheduledServiceImpl implements ScheduledService {
@Override
public
void
run
()
{
try
{
snodeController
.
getEnodeService
().
updateEnodeAddr
(
snodeConfig
.
getClusterName
());
snodeController
.
getEnodeService
().
updateEnodeAddr
ess
(
snodeConfig
.
getClusterName
());
}
catch
(
Exception
ex
)
{
log
.
warn
(
"Update broker addr error:{}"
,
ex
);
}
...
...
snode/src/test/java/org/apache/rocketmq/snode/SnodeControllerTest.java
浏览文件 @
82f53573
...
...
@@ -27,8 +27,10 @@ public class SnodeControllerTest {
@Test
public
void
testSnodeRestart
()
{
ServerConfig
serverConfig
=
new
ServerConfig
();
serverConfig
.
setListenPort
(
10912
);
SnodeController
snodeController
=
new
SnodeController
(
new
ServerConfig
()
,
serverConfig
,
new
ClientConfig
(),
new
SnodeConfig
());
assertThat
(
snodeController
.
initialize
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录