Search in sources :

Example 1 with ConsumerConfigInfo

use of org.apache.rocketmq.console.model.request.ConsumerConfigInfo in project rocketmq-externals by apache.

the class ConsumerServiceImpl method examineSubscriptionGroupConfig.

@Override
@MultiMQAdminCmdMethod
public List<ConsumerConfigInfo> examineSubscriptionGroupConfig(String group) {
    List<ConsumerConfigInfo> consumerConfigInfoList = Lists.newArrayList();
    try {
        ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo();
        for (String brokerName : clusterInfo.getBrokerAddrTable().keySet()) {
            // foreach brokerName
            String brokerAddress = clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr();
            SubscriptionGroupConfig subscriptionGroupConfig = mqAdminExt.examineSubscriptionGroupConfig(brokerAddress, group);
            if (subscriptionGroupConfig == null) {
                continue;
            }
            consumerConfigInfoList.add(new ConsumerConfigInfo(Lists.newArrayList(brokerName), subscriptionGroupConfig));
        }
    } catch (Exception e) {
        throw propagate(e);
    }
    return consumerConfigInfoList;
}
Also used : ClusterInfo(org.apache.rocketmq.common.protocol.body.ClusterInfo) ConsumerConfigInfo(org.apache.rocketmq.console.model.request.ConsumerConfigInfo) SubscriptionGroupConfig(org.apache.rocketmq.common.subscription.SubscriptionGroupConfig) MQClientException(org.apache.rocketmq.client.exception.MQClientException) MultiMQAdminCmdMethod(org.apache.rocketmq.console.aspect.admin.annotation.MultiMQAdminCmdMethod)

Example 2 with ConsumerConfigInfo

use of org.apache.rocketmq.console.model.request.ConsumerConfigInfo in project rocketmq-externals by apache.

the class ConsumerServiceImplTest method createAndUpdateSubscriptionGroupConfig.

@Test
public void createAndUpdateSubscriptionGroupConfig() throws Exception {
    ConsumerConfigInfo consumerConfigInfoForCreate = new ConsumerConfigInfo();
    BeanUtils.copyProperties(consumerConfigInfo, consumerConfigInfoForCreate);
    consumerConfigInfoForCreate.getSubscriptionGroupConfig().setGroupName(TEST_CREATE_DELETE_CONSUMER_GROUP);
    Assert.assertTrue(consumerService.createAndUpdateSubscriptionGroupConfig(consumerConfigInfoForCreate));
    Assert.assertTrue(CollectionUtils.isNotEmpty(consumerService.examineSubscriptionGroupConfig(TEST_CREATE_DELETE_CONSUMER_GROUP)));
}
Also used : ConsumerConfigInfo(org.apache.rocketmq.console.model.request.ConsumerConfigInfo) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with ConsumerConfigInfo

use of org.apache.rocketmq.console.model.request.ConsumerConfigInfo in project rocketmq-externals by apache.

the class ConsumerServiceImplTest method deleteSubGroup.

@Test
public void deleteSubGroup() throws Exception {
    createAndUpdateSubscriptionGroupConfig();
    DeleteSubGroupRequest deleteSubGroupRequest = new DeleteSubGroupRequest();
    deleteSubGroupRequest.setBrokerNameList(Lists.<String>newArrayList(TestConstant.TEST_BROKER_NAME));
    deleteSubGroupRequest.setGroupName(TEST_CREATE_DELETE_CONSUMER_GROUP);
    Assert.assertTrue(consumerService.deleteSubGroup(deleteSubGroupRequest));
    List<ConsumerConfigInfo> groupConsumeInfoList = consumerService.examineSubscriptionGroupConfig(TEST_CREATE_DELETE_CONSUMER_GROUP);
    Assert.assertTrue(CollectionUtils.isEmpty(groupConsumeInfoList));
}
Also used : ConsumerConfigInfo(org.apache.rocketmq.console.model.request.ConsumerConfigInfo) DeleteSubGroupRequest(org.apache.rocketmq.console.model.request.DeleteSubGroupRequest) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ConsumerConfigInfo (org.apache.rocketmq.console.model.request.ConsumerConfigInfo)3 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 MQClientException (org.apache.rocketmq.client.exception.MQClientException)1 ClusterInfo (org.apache.rocketmq.common.protocol.body.ClusterInfo)1 SubscriptionGroupConfig (org.apache.rocketmq.common.subscription.SubscriptionGroupConfig)1 MultiMQAdminCmdMethod (org.apache.rocketmq.console.aspect.admin.annotation.MultiMQAdminCmdMethod)1 DeleteSubGroupRequest (org.apache.rocketmq.console.model.request.DeleteSubGroupRequest)1