rocketmq源碼解析之管理請求從broker中獲取system topics

說在前面apache

管理請求 GET_SYSTEM_TOPIC_LIST_FROM_BROKER 獲取broker中的system topic列表json

 

源碼解析微信

進入到這個方法org.apache.rocketmq.broker.processor.AdminBrokerProcessor#getSystemTopicListFromBrokerthis

private RemotingCommand getSystemTopicListFromBroker(ChannelHandlerContext ctx, RemotingCommand request)
        throws RemotingCommandException {
        final RemotingCommand response = RemotingCommand.createResponseCommand(null);
//        查詢system topic列表=》
        Set<String> topics = this.brokerController.getTopicConfigManager().getSystemTopic();
        TopicList topicList = new TopicList();
        topicList.setTopicList(topics);
//        消息json編碼=》
        response.setBody(topicList.encode());
        response.setCode(ResponseCode.SUCCESS);
        response.setRemark(null);
        return response;
    }

進入到這個方法org.apache.rocketmq.broker.topic.TopicConfigManager#getSystemTopic編碼

public Set<String> getSystemTopic() {
    return this.systemTopicList;
}

內存存儲路徑code

private final Set<String> systemTopicList = new HashSet<String>();

往上返回到這個方法org.apache.rocketmq.remoting.protocol.RemotingSerializable#encode()對topic進行json編碼blog

public byte[] encode() {
    final String json = this.toJson();
    if (json != null) {
        return json.getBytes(CHARSET_UTF8);
    }
    return null;
}

往上返回到這個方法org.apache.rocketmq.broker.processor.AdminBrokerProcessor#getSystemTopicListFromBroker結束內存

 

說在最後rem

本次解析僅表明我的觀點,僅供參考。get

 

加入技術微信羣

釘釘技術羣

相關文章
相關標籤/搜索