vernedeng commented on code in PR #8588:
URL: https://github.com/apache/inlong/pull/8588#discussion_r1277126612
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/queue/kafka/KafkaOperator.java:
##########
@@ -79,4 +109,70 @@ public boolean topicIsExists(KafkaClusterInfo
kafkaClusterInfo, String topic)
return topicList.contains(topic);
}
+ public List<BriefMQMessage> queryLatestMessage(KafkaClusterInfo
kafkaClusterInfo, String topicName,
+ Integer messageCount, InlongStreamInfo streamInfo) {
+ LOGGER.info("begin to query message for topic {} in cluster: {}",
topicName, kafkaClusterInfo);
+
+ Properties properties = new Properties();
+ properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
kafkaClusterInfo.getUrl());
+ properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
ByteArrayDeserializer.class.getName());
+ properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
ByteArrayDeserializer.class.getName());
+ properties.put(ConsumerConfig.GROUP_ID_CONFIG, "QueryLatestMessage-" +
Utils.getUUID());
Review Comment:
It's better to use the same subscription and reset the offset of the target
topic to the latest for each query.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]