Search in sources :

Example 6 with GetMinOffsetResponseHeader

use of org.apache.rocketmq.common.protocol.header.GetMinOffsetResponseHeader in project rocketmq by apache.

the class AdminBrokerProcessor method getMinOffset.

private RemotingCommand getMinOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final RemotingCommand response = RemotingCommand.createResponseCommand(GetMinOffsetResponseHeader.class);
    final GetMinOffsetResponseHeader responseHeader = (GetMinOffsetResponseHeader) response.readCustomHeader();
    final GetMinOffsetRequestHeader requestHeader = (GetMinOffsetRequestHeader) request.decodeCommandCustomHeader(GetMinOffsetRequestHeader.class);
    long offset = this.brokerController.getMessageStore().getMinOffsetInQueue(requestHeader.getTopic(), requestHeader.getQueueId());
    responseHeader.setOffset(offset);
    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);
    return response;
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) GetMinOffsetRequestHeader(org.apache.rocketmq.common.protocol.header.GetMinOffsetRequestHeader) GetMinOffsetResponseHeader(org.apache.rocketmq.common.protocol.header.GetMinOffsetResponseHeader)

Aggregations

GetMinOffsetRequestHeader (org.apache.rocketmq.common.protocol.header.GetMinOffsetRequestHeader)6 GetMinOffsetResponseHeader (org.apache.rocketmq.common.protocol.header.GetMinOffsetResponseHeader)6 RemotingCommand (org.apache.rocketmq.remoting.protocol.RemotingCommand)6 MQBrokerException (org.apache.rocketmq.client.exception.MQBrokerException)3