Java源码示例:org.springframework.kafka.core.KafkaAdmin

示例1
/**
 * Defining a {@link KafkaAdmin} bean allows to automatically add topic to the broker via {@link NewTopic} beans
 */
@Bean
public KafkaAdmin kafkaAdmin() {
    Map<String, Object> configs = new HashMap<>();
    configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapAddress);
    return new KafkaAdmin(configs);
}
 
示例2
@Bean
public KafkaAdmin admin() {
    Map<String, Object> configs = new HashMap<>();
    configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
            servers);
    return new KafkaAdmin(configs);
}
 
示例3
@Bean
public KafkaAdmin kafkaAdmin() {
    Map<String, Object> map = new HashMap<>(1);
    map.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapServers);
    return new KafkaAdmin(map);
}
 
示例4
@Bean
public KafkaAdmin kafkaAdmin() {
    Map<String, Object> configs = new HashMap<>();
    configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
    return new KafkaAdmin(configs);
}