Skip to content

Instantly share code, notes, and snippets.

@engleangs
Created January 18, 2022 16:59
Show Gist options
  • Save engleangs/0c0208bcfdbd2e543e89049bd717f64e to your computer and use it in GitHub Desktop.
Save engleangs/0c0208bcfdbd2e543e89049bd717f64e to your computer and use it in GitHub Desktop.
@Configuration
public class KafkaTopicConfig {
private static final Logger LOGGER = LoggerFactory.getLogger( KafkaTopicConfig.class);
@Value(value = "${kafka.bootstrapAddress}")
private String bootstrapAddress;
@Bean
public KafkaAdmin kafkaAdmin() {
LOGGER.info("kafka admin address "+bootstrapAddress);
Map<String, Object> configs = new HashMap<>();
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
return new KafkaAdmin(configs);
}
@Bean
public NewTopic topicSend() {
return new NewTopic("sms_api_send", 1, (short) 1);
}
@Bean
public NewTopic topicReceive() {
return new NewTopic("sms_receiving", 1, (short) 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment