[ISSUE #42]Fix deleteSubscriptionGroup not remove consumer offset. (#45)

Co-authored-by: zhangjidi2016 <zhangjidi@cmss.chinamobile.com>
This commit is contained in:
zhangjidi2016
2021-11-17 13:30:12 +08:00
committed by GitHub
parent a5a3659c04
commit e660c7d874
3 changed files with 6 additions and 3 deletions

View File

@@ -278,8 +278,9 @@ public class MQAdminExtImpl implements MQAdminExt {
} }
@Override @Override
public void deleteSubscriptionGroup(String addr, String groupName, boolean removeOffset) throws RemotingException, MQBrokerException, InterruptedException, MQClientException { public void deleteSubscriptionGroup(String addr, String groupName, boolean removeOffset)
throw new UnsupportedOperationException(); throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
MQAdminInstance.threadLocalMQAdminExt().deleteSubscriptionGroup(addr, groupName, removeOffset);
} }
@Override @Override

View File

@@ -294,7 +294,7 @@ public class ConsumerServiceImpl extends AbstractCommonService implements Consum
ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo();
for (String brokerName : deleteSubGroupRequest.getBrokerNameList()) { for (String brokerName : deleteSubGroupRequest.getBrokerNameList()) {
logger.info("addr={} groupName={}", clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName()); logger.info("addr={} groupName={}", clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName());
mqAdminExt.deleteSubscriptionGroup(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName()); mqAdminExt.deleteSubscriptionGroup(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName(), true);
} }
} }
catch (Exception e) { catch (Exception e) {

View File

@@ -418,8 +418,10 @@ public class MQAdminExtImplTest {
assertNotNull(mqAdminExtImpl); assertNotNull(mqAdminExtImpl);
{ {
doNothing().when(defaultMQAdminExt).deleteSubscriptionGroup(anyString(), anyString()); doNothing().when(defaultMQAdminExt).deleteSubscriptionGroup(anyString(), anyString());
doNothing().when(defaultMQAdminExt).deleteSubscriptionGroup(anyString(), anyString(), anyBoolean());
} }
mqAdminExtImpl.deleteSubscriptionGroup(brokerAddr, "group_test"); mqAdminExtImpl.deleteSubscriptionGroup(brokerAddr, "group_test");
mqAdminExtImpl.deleteSubscriptionGroup(brokerAddr, "group_test", true);
} }
@Test @Test