集群同步-》同步消费位点
This commit is contained in:
@@ -30,4 +30,6 @@ public interface ConsumerService {
|
||||
ResponseData resetPartitionToTargetOffset(String groupId, TopicPartition partition, long offset);
|
||||
|
||||
ResponseData getGroupIdList();
|
||||
|
||||
ResponseData getSubscribeTopicList(String groupId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xuxd.kafka.console.service;
|
||||
|
||||
import com.xuxd.kafka.console.beans.ResponseData;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* kafka-console-ui.
|
||||
*
|
||||
* @author xuxd
|
||||
* @date 2021-10-24 23:12:43
|
||||
**/
|
||||
public interface OperationService {
|
||||
|
||||
ResponseData syncConsumerOffset(String groupId, String topic, Properties thatProps);
|
||||
}
|
||||
@@ -138,4 +138,8 @@ public class ConsumerServiceImpl implements ConsumerService {
|
||||
Set<String> stateGroup = consumerConsole.getConsumerGroupIdList(null);
|
||||
return ResponseData.create().data(stateGroup).success();
|
||||
}
|
||||
|
||||
@Override public ResponseData getSubscribeTopicList(String groupId) {
|
||||
return ResponseData.create().data(consumerConsole.listSubscribeTopics(groupId).keySet()).success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xuxd.kafka.console.service.impl;
|
||||
|
||||
import com.xuxd.kafka.console.beans.ResponseData;
|
||||
import com.xuxd.kafka.console.service.OperationService;
|
||||
import java.util.Properties;
|
||||
import kafka.console.OperationConsole;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import scala.Tuple2;
|
||||
|
||||
/**
|
||||
* kafka-console-ui.
|
||||
*
|
||||
* @author xuxd
|
||||
* @date 2021-10-24 23:12:54
|
||||
**/
|
||||
@Service
|
||||
public class OperationServiceImpl implements OperationService {
|
||||
|
||||
@Autowired
|
||||
private OperationConsole operationConsole;
|
||||
|
||||
@Override public ResponseData syncConsumerOffset(String groupId, String topic, Properties thatProps) {
|
||||
|
||||
Tuple2<Object, String> tuple2 = operationConsole.syncConsumerOffset(groupId, topic, thatProps);
|
||||
|
||||
return (boolean) tuple2._1() ? ResponseData.create().success() : ResponseData.create().failed(tuple2._2());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user