Implement review remarks
This commit is contained in:
parent
225f1082f4
commit
4ab7e57580
@ -3,7 +3,7 @@
|
||||
|
||||
== Version 1.1.0
|
||||
|
||||
* Always set the kafka consumer group of this health check
|
||||
* Make consumer groups unique by appending a random UUID when no group ID is configured explicitly.
|
||||
|
||||
== Version 0.1.0
|
||||
|
||||
|
@ -42,6 +42,7 @@ import javax.annotation.PreDestroy;
|
||||
public class KafkaConsumingHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(KafkaConsumingHealthIndicator.class);
|
||||
private static final String CONSUMER_GROUP_PREFIX = "health-check-";
|
||||
|
||||
private final Consumer<String, String> consumer;
|
||||
|
||||
@ -98,7 +99,7 @@ public class KafkaConsumingHealthIndicator extends AbstractHealthIndicator {
|
||||
String groupId = (String) kafkaConsumerProperties.getOrDefault(ConsumerConfig.GROUP_ID_CONFIG,
|
||||
UUID.randomUUID().toString());
|
||||
kafkaConsumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG,
|
||||
groupId + "-health-check-" + InetAddress.getLocalHost().getHostAddress());
|
||||
CONSUMER_GROUP_PREFIX + groupId + "-" + InetAddress.getLocalHost().getHostAddress());
|
||||
} catch (UnknownHostException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user