Search in sources :

Example 6 with ClusterInfo

use of org.apache.rocketmq.common.protocol.body.ClusterInfo in project rocketmq-externals by apache.

the class ConsumerServiceImpl method deleteSubGroup.

@Override
@MultiMQAdminCmdMethod
public boolean deleteSubGroup(DeleteSubGroupRequest deleteSubGroupRequest) {
    try {
        ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo();
        for (String brokerName : deleteSubGroupRequest.getBrokerNameList()) {
            logger.info("addr={} groupName={}", clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName());
            mqAdminExt.deleteSubscriptionGroup(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName());
        }
    } catch (Exception e) {
        throw propagate(e);
    }
    return true;
}
Also used : ClusterInfo(org.apache.rocketmq.common.protocol.body.ClusterInfo) MQClientException(org.apache.rocketmq.client.exception.MQClientException) MultiMQAdminCmdMethod(org.apache.rocketmq.console.aspect.admin.annotation.MultiMQAdminCmdMethod)

Example 7 with ClusterInfo

use of org.apache.rocketmq.common.protocol.body.ClusterInfo in project rocketmq-externals by apache.

the class TopicServiceImpl method deleteTopicInBroker.

@Override
public boolean deleteTopicInBroker(String brokerName, String topic) {
    try {
        ClusterInfo clusterInfo = null;
        try {
            clusterInfo = mqAdminExt.examineBrokerClusterInfo();
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
        mqAdminExt.deleteTopicInBroker(Sets.newHashSet(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr()), topic);
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
    return true;
}
Also used : ClusterInfo(org.apache.rocketmq.common.protocol.body.ClusterInfo)

Example 8 with ClusterInfo

use of org.apache.rocketmq.common.protocol.body.ClusterInfo in project rocketmq-externals by apache.

the class TopicServiceImpl method createOrUpdate.

@Override
public void createOrUpdate(TopicConfigInfo topicCreateOrUpdateRequest) {
    TopicConfig topicConfig = new TopicConfig();
    BeanUtils.copyProperties(topicCreateOrUpdateRequest, topicConfig);
    try {
        ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo();
        for (String brokerName : changeToBrokerNameSet(clusterInfo.getClusterAddrTable(), topicCreateOrUpdateRequest.getClusterNameList(), topicCreateOrUpdateRequest.getBrokerNameList())) {
            mqAdminExt.createAndUpdateTopicConfig(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), topicConfig);
        }
    } catch (Exception err) {
        throw Throwables.propagate(err);
    }
}
Also used : ClusterInfo(org.apache.rocketmq.common.protocol.body.ClusterInfo) TopicConfig(org.apache.rocketmq.common.TopicConfig)

Aggregations

ClusterInfo (org.apache.rocketmq.common.protocol.body.ClusterInfo)8 Map (java.util.Map)3 MQClientException (org.apache.rocketmq.client.exception.MQClientException)3 BrokerData (org.apache.rocketmq.common.protocol.route.BrokerData)3 MultiMQAdminCmdMethod (org.apache.rocketmq.console.aspect.admin.annotation.MultiMQAdminCmdMethod)3 KVTable (org.apache.rocketmq.common.protocol.body.KVTable)2 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ExecutionException (java.util.concurrent.ExecutionException)1 TopicConfig (org.apache.rocketmq.common.TopicConfig)1 SubscriptionGroupWrapper (org.apache.rocketmq.common.protocol.body.SubscriptionGroupWrapper)1 SubscriptionGroupConfig (org.apache.rocketmq.common.subscription.SubscriptionGroupConfig)1 GroupConsumeInfo (org.apache.rocketmq.console.model.GroupConsumeInfo)1 ConsumerConfigInfo (org.apache.rocketmq.console.model.request.ConsumerConfigInfo)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1