Kafka Samples - Provision Topics
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
* Copyright 2015-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.integration.samples.kafka;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.kafka.clients.admin.NewTopic;
|
||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||
|
||||
@@ -150,6 +151,20 @@ public class Application {
|
||||
return new QueueChannel();
|
||||
}
|
||||
|
||||
/*
|
||||
* Boot's autoconfigured KafkaAdmin will provision the topics.
|
||||
*/
|
||||
|
||||
@Bean
|
||||
public NewTopic topic(KafkaAppProperties properties) {
|
||||
return new NewTopic(properties.getTopic(), 1, (short) 1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NewTopic newTopic(KafkaAppProperties properties) {
|
||||
return new NewTopic(properties.getNewTopic(), 1, (short) 1);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IntegrationFlowContext flowContext;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.integration.samples.dsl.kafka;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.kafka.clients.admin.NewTopic;
|
||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -115,6 +116,20 @@ public class Application {
|
||||
.get();
|
||||
}
|
||||
|
||||
/*
|
||||
* Boot's autoconfigured KafkaAdmin will provision the topics.
|
||||
*/
|
||||
|
||||
@Bean
|
||||
public NewTopic topic(KafkaAppProperties properties) {
|
||||
return new NewTopic(properties.getTopic(), 1, (short) 1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NewTopic newTopic(KafkaAppProperties properties) {
|
||||
return new NewTopic(properties.getNewTopic(), 1, (short) 1);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IntegrationFlowContext flowContext;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user