Rename SimpleKafkaListenerContainerFactory

Rename to `ConcurrentConcurrentKafkaListenerContainerFactory` to reflect
the type of container it actually creates.
This commit is contained in:
Gary Russell
2016-05-13 13:07:07 -04:00
parent ead9783087
commit 560ff6f088
5 changed files with 23 additions and 18 deletions

View File

@@ -36,8 +36,8 @@ import org.springframework.context.annotation.Import;
* @EnableKafka
* public class AppConfig {
* @Bean
* public SimpleKafkaListenerContainerFactory myKafkaListenerContainerFactory() {
* SimpleKafkaListenerContainerFactory factory = new SimpleKafkaListenerContainerFactory();
* public ConcurrentKafkaListenerContainerFactory myKafkaListenerContainerFactory() {
* ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory();
* factory.setConsumerFactory(consumerFactory());
* factory.setConcurrency(4);
* return factory;
@@ -48,8 +48,8 @@ import org.springframework.context.annotation.Import;
*
* The {@code KafkaListenerContainerFactory} is responsible to create the listener
* container for a particular endpoint. Typical implementations, as the
* {@link org.springframework.kafka.config.SimpleKafkaListenerContainerFactory
* SimpleKafkaListenerContainerFactory} used in the sample above, provides the necessary
* {@link org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory
* ConcurrentKafkaListenerContainerFactory} used in the sample above, provides the necessary
* configuration options that are supported by the underlying
* {@link org.springframework.kafka.listener.MessageListenerContainer
* MessageListenerContainer}.

View File

@@ -25,11 +25,11 @@ import org.apache.kafka.common.TopicPartition;
import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;
/**
* A {@link KafkaListenerContainerFactory} implementation to build a regular
* A {@link KafkaListenerContainerFactory} implementation to build a
* {@link ConcurrentMessageListenerContainer}.
* <p>
* This should be the default for most users and a good transition paths
* for those that are used to build such container definition manually.
* for those that are used to build such container definitions manually.
*
* @param <K> the key type.
* @param <V> the value type.
@@ -39,7 +39,7 @@ import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;
* @author Artem Bilan
* @author Murali Reddy
*/
public class SimpleKafkaListenerContainerFactory<K, V>
public class ConcurrentKafkaListenerContainerFactory<K, V>
extends AbstractKafkaListenerContainerFactory<ConcurrentMessageListenerContainer<K, V>, K, V> {
private Integer concurrency;

View File

@@ -36,9 +36,9 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.config.KafkaListenerContainerFactory;
import org.springframework.kafka.config.KafkaListenerEndpointRegistry;
import org.springframework.kafka.config.SimpleKafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
@@ -192,7 +192,8 @@ public class EnableKafkaIntegrationTests {
@Bean
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Integer, String>>
kafkaListenerContainerFactory() {
SimpleKafkaListenerContainerFactory<Integer, String> factory = new SimpleKafkaListenerContainerFactory<>();
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
return factory;
}
@@ -200,7 +201,8 @@ public class EnableKafkaIntegrationTests {
@Bean
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Integer, String>>
kafkaJsonListenerContainerFactory() {
SimpleKafkaListenerContainerFactory<Integer, String> factory = new SimpleKafkaListenerContainerFactory<>();
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
factory.setMessageConverter(new StringJsonMessageConverter());
return factory;
@@ -209,7 +211,8 @@ public class EnableKafkaIntegrationTests {
@Bean
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Integer, String>>
kafkaManualAckListenerContainerFactory() {
SimpleKafkaListenerContainerFactory<Integer, String> factory = new SimpleKafkaListenerContainerFactory<>();
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(manualConsumerFactory());
factory.setAckMode(AckMode.MANUAL_IMMEDIATE);
return factory;
@@ -218,7 +221,8 @@ public class EnableKafkaIntegrationTests {
@Bean
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Integer, String>>
kafkaAutoStartFalseListenerContainerFactory() {
SimpleKafkaListenerContainerFactory<Integer, String> factory = new SimpleKafkaListenerContainerFactory<>();
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
factory.setAutoStartup(false);
factory.setSyncCommits(false);
@@ -230,7 +234,8 @@ public class EnableKafkaIntegrationTests {
@Bean
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Integer, String>>
kafkaRebalanceListenerContainerFactory() {
SimpleKafkaListenerContainerFactory<Integer, String> factory = new SimpleKafkaListenerContainerFactory<>();
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
factory.setConsumerRebalanceListener(consumerRebalanceListener());
return factory;

View File

@@ -267,8 +267,8 @@ This mechanism requires a listener container factory, which is used to configure
@Bean
KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Integer, String>>
kafkaListenerContainerFactory() {
SimpleKafkaListenerContainerFactory<Integer, String> factory =
new SimpleKafkaListenerContainerFactory<>();
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
factory.setConcurrency(3);
return factory;

View File

@@ -136,10 +136,10 @@ public void testSimple() throws Exception {
public class Config {
@Bean
SimpleKafkaListenerContainerFactory<Integer, String>
ConcurrentKafkaListenerContainerFactory<Integer, String>
kafkaListenerContainerFactory() {
SimpleKafkaListenerContainerFactory<Integer, String> factory =
new SimpleKafkaListenerContainerFactory<>();
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
return factory;
}