Search in sources :

Example 6 with ResetOffsetBody

use of org.apache.rocketmq.common.protocol.body.ResetOffsetBody in project rocketmq by apache.

the class ClientRemotingProcessor method resetOffset.

public RemotingCommand resetOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final ResetOffsetRequestHeader requestHeader = (ResetOffsetRequestHeader) request.decodeCommandCustomHeader(ResetOffsetRequestHeader.class);
    log.info("invoke reset offset operation from broker. brokerAddr={}, topic={}, group={}, timestamp={}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()), requestHeader.getTopic(), requestHeader.getGroup(), requestHeader.getTimestamp());
    Map<MessageQueue, Long> offsetTable = new HashMap<MessageQueue, Long>();
    if (request.getBody() != null) {
        ResetOffsetBody body = ResetOffsetBody.decode(request.getBody(), ResetOffsetBody.class);
        offsetTable = body.getOffsetTable();
    }
    this.mqClientFactory.resetOffset(requestHeader.getTopic(), requestHeader.getGroup(), offsetTable);
    return null;
}
Also used : MessageQueue(org.apache.rocketmq.common.message.MessageQueue) HashMap(java.util.HashMap) ResetOffsetRequestHeader(org.apache.rocketmq.common.protocol.header.ResetOffsetRequestHeader) ResetOffsetBody(org.apache.rocketmq.common.protocol.body.ResetOffsetBody)

Aggregations

ResetOffsetBody (org.apache.rocketmq.common.protocol.body.ResetOffsetBody)6 ResetOffsetRequestHeader (org.apache.rocketmq.common.protocol.header.ResetOffsetRequestHeader)6 HashMap (java.util.HashMap)4 MessageQueue (org.apache.rocketmq.common.message.MessageQueue)4 RemotingCommand (org.apache.rocketmq.remoting.protocol.RemotingCommand)4 Channel (io.netty.channel.Channel)2 Map (java.util.Map)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 ClientChannelInfo (org.apache.rocketmq.broker.client.ClientChannelInfo)2 ConsumerGroupInfo (org.apache.rocketmq.broker.client.ConsumerGroupInfo)2 MQClientException (org.apache.rocketmq.client.exception.MQClientException)2 TopicConfig (org.apache.rocketmq.common.TopicConfig)2 MessageQueueForC (org.apache.rocketmq.common.message.MessageQueueForC)2 ResetOffsetBodyForC (org.apache.rocketmq.common.protocol.body.ResetOffsetBodyForC)2 RemotingSendRequestException (org.apache.rocketmq.remoting.exception.RemotingSendRequestException)2 RemotingTimeoutException (org.apache.rocketmq.remoting.exception.RemotingTimeoutException)2