org.apache.rocketmq.common.protocol.header.GetConsumerRunningInfoRequestHeader Java Examples

The following examples show how to use org.apache.rocketmq.common.protocol.header.GetConsumerRunningInfoRequestHeader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientRemotingProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    ConsumerRunningInfo consumerRunningInfo = this.mqClientFactory.consumerRunningInfo(requestHeader.getConsumerGroup());
    if (null != consumerRunningInfo) {
        if (requestHeader.isJstackEnable()) {
            Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
            String jstack = UtilAll.jstack(map);
            consumerRunningInfo.setJstack(jstack);
        }

        response.setCode(ResponseCode.SUCCESS);
        response.setBody(consumerRunningInfo.encode());
    } else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #2
Source File: ClientRemotingProcessor.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
        RemotingCommand request) throws RemotingCommandException {
        final RemotingCommand response = RemotingCommand.createResponseCommand(null);
        final GetConsumerRunningInfoRequestHeader requestHeader =
            (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

//        获取消费者的运行信息=》
        ConsumerRunningInfo consumerRunningInfo = this.mqClientFactory.consumerRunningInfo(requestHeader.getConsumerGroup());
        if (null != consumerRunningInfo) {
            if (requestHeader.isJstackEnable()) {
                Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
//                获取所有的线程堆栈信息
                String jstack = UtilAll.jstack(map);
                consumerRunningInfo.setJstack(jstack);
            }

            response.setCode(ResponseCode.SUCCESS);
            response.setBody(consumerRunningInfo.encode());
        } else {
            response.setCode(ResponseCode.SYSTEM_ERROR);
            response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
        }

        return response;
    }
 
Example #3
Source File: ClientRemotingProcessor.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    ConsumerRunningInfo consumerRunningInfo = this.mqClientFactory.consumerRunningInfo(requestHeader.getConsumerGroup());
    if (null != consumerRunningInfo) {
        if (requestHeader.isJstackEnable()) {
            Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
            String jstack = UtilAll.jstack(map);
            consumerRunningInfo.setJstack(jstack);
        }

        response.setCode(ResponseCode.SUCCESS);
        response.setBody(consumerRunningInfo.encode());
    } else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #4
Source File: ClientRemotingProcessor.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    ConsumerRunningInfo consumerRunningInfo = this.mqClientFactory.consumerRunningInfo(requestHeader.getConsumerGroup());
    if (null != consumerRunningInfo) {
        if (requestHeader.isJstackEnable()) {
            Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
            String jstack = UtilAll.jstack(map);
            consumerRunningInfo.setJstack(jstack);
        }

        response.setCode(ResponseCode.SUCCESS);
        response.setBody(consumerRunningInfo.encode());
    } else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #5
Source File: ClientRemotingProcessor.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    ConsumerRunningInfo consumerRunningInfo = this.mqClientFactory.consumerRunningInfo(requestHeader.getConsumerGroup());
    if (null != consumerRunningInfo) {
        if (requestHeader.isJstackEnable()) {
            Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
            String jstack = UtilAll.jstack(map);
            consumerRunningInfo.setJstack(jstack);
        }

        response.setCode(ResponseCode.SUCCESS);
        response.setBody(consumerRunningInfo.encode());
    } else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #6
Source File: ClientRemotingProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    ConsumerRunningInfo consumerRunningInfo = this.mqClientFactory.consumerRunningInfo(requestHeader.getConsumerGroup());
    if (null != consumerRunningInfo) {
        if (requestHeader.isJstackEnable()) {
            Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
            String jstack = UtilAll.jstack(map);
            consumerRunningInfo.setJstack(jstack);
        }

        response.setCode(ResponseCode.SUCCESS);
        response.setBody(consumerRunningInfo.encode());
    } else {
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark(String.format("The Consumer Group <%s> not exist in this consumer", requestHeader.getConsumerGroup()));
    }

    return response;
}
 
Example #7
Source File: AdminBrokerProcessor.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    return this.callConsumer(RequestCode.GET_CONSUMER_RUNNING_INFO, request, requestHeader.getConsumerGroup(),
        requestHeader.getClientId());
}
 
Example #8
Source File: AdminBrokerProcessor.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
        RemotingCommand request) throws RemotingCommandException {
        final GetConsumerRunningInfoRequestHeader requestHeader =
            (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

//        =》
        return this.callConsumer(RequestCode.GET_CONSUMER_RUNNING_INFO, request, requestHeader.getConsumerGroup(),
            requestHeader.getClientId());
    }
 
Example #9
Source File: AdminBrokerProcessor.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * 获取消费者运行时信息
 * @param ctx ;
 * @param request ;
 * @return ;
 * @throws RemotingCommandException ;
 */
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {

    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    return this.callConsumer(RequestCode.GET_CONSUMER_RUNNING_INFO, request, requestHeader.getConsumerGroup(),
        requestHeader.getClientId());
}
 
Example #10
Source File: AdminBrokerProcessor.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**

     */
    private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
        final GetConsumerRunningInfoRequestHeader requestHeader =
            (GetConsumerRunningInfoRequestHeader)request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

        return this.callConsumer(RequestCode.GET_CONSUMER_RUNNING_INFO, request, requestHeader.getConsumerGroup(),
            requestHeader.getClientId());
    }
 
Example #11
Source File: AdminBrokerProcessor.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    return this.callConsumer(RequestCode.GET_CONSUMER_RUNNING_INFO, request, requestHeader.getConsumerGroup(),
        requestHeader.getClientId());
}
 
Example #12
Source File: AdminBrokerProcessor.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
/**

     */
    private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
        final GetConsumerRunningInfoRequestHeader requestHeader =
            (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

        return this.callConsumer(RequestCode.GET_CONSUMER_RUNNING_INFO, request, requestHeader.getConsumerGroup(),
            requestHeader.getClientId());
    }
 
Example #13
Source File: AdminBrokerProcessor.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final GetConsumerRunningInfoRequestHeader requestHeader =
        (GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);

    return this.callConsumer(RequestCode.GET_CONSUMER_RUNNING_INFO, request, requestHeader.getConsumerGroup(),
        requestHeader.getClientId());
}