rocketmq 之namesrv(十八)mqclient admin请求处理获取所有的订阅组配置信息

获取所有的订阅组配置信息AdminBrokerProcessor#getAllSubscriptionGroup

AdminBrokerProcessor#processRequest#this.getAllSubscriptionGroup(ctx, request)

private RemotingCommand getAllSubscriptionGroup(ChannelHandlerContext ctx,
        RemotingCommand request) throws RemotingCommandException {
        final RemotingCommand response = RemotingCommand.createResponseCommand(null);
        /*获取订阅组管理器并解析*/
        String content = this.brokerController.getSubscriptionGroupManager().encode();
        if (content != null && content.length() > 0) {
            try {
                response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
            } catch (UnsupportedEncodingException e) {
                log.error("", e);

                response.setCode(ResponseCode.SYSTEM_ERROR);
                response.setRemark("UnsupportedEncodingException " + e);
                return response;
            }
        } else {
            log.error("No subscription group in this broker, client:{} ", ctx.channel().remoteAddress());
            response.setCode(ResponseCode.SYSTEM_ERROR);
            response.setRemark("No subscription group in this broker");
            return response;
        }

        response.setCode(ResponseCode.SUCCESS);
        response.setRemark(null);

        return response;
    }
    ```
发布了212 篇原创文章 · 获赞 64 · 访问量 27万+

猜你喜欢

转载自blog.csdn.net/qq_26400953/article/details/104638161