Package org.springframework.kafka.config
Class ConcurrentKafkaListenerContainerFactory<K,V>
- java.lang.Object
-
- org.springframework.kafka.config.AbstractKafkaListenerContainerFactory<ConcurrentMessageListenerContainer<K,V>,K,V>
-
- org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory<K,V>
-
- Type Parameters:
K
- the key type.V
- the value type.
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.context.ApplicationEventPublisherAware
,KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<K,V>>
public class ConcurrentKafkaListenerContainerFactory<K,V> extends AbstractKafkaListenerContainerFactory<ConcurrentMessageListenerContainer<K,V>,K,V>
AKafkaListenerContainerFactory
implementation to build aConcurrentMessageListenerContainer
.This should be the default for most users and a good transition paths for those that are used to building such container definitions manually. This factory is primarily for building containers for
KafkaListener
annotated methods but can also be used to create any container. Only containers forKafkaListener
annotated methods are added to theKafkaListenerEndpointRegistry
.- Author:
- Stephane Nicoll, Gary Russell, Artem Bilan, Murali Reddy
-
-
Field Summary
-
Fields inherited from class org.springframework.kafka.config.AbstractKafkaListenerContainerFactory
logger
-
-
Constructor Summary
Constructors Constructor Description ConcurrentKafkaListenerContainerFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConcurrentMessageListenerContainer<K,V>
createContainerInstance(KafkaListenerEndpoint endpoint)
Create an empty container instance.protected void
initializeContainer(ConcurrentMessageListenerContainer<K,V> instance, KafkaListenerEndpoint endpoint)
Further initialize the specified container.void
setConcurrency(java.lang.Integer concurrency)
Specify the container concurrency.-
Methods inherited from class org.springframework.kafka.config.AbstractKafkaListenerContainerFactory
afterPropertiesSet, createContainer, createContainer, createContainer, createListenerContainer, getConsumerFactory, getContainerProperties, isBatchListener, setAckDiscarded, setAfterRollbackProcessor, setApplicationContext, setApplicationEventPublisher, setAutoStartup, setBatchErrorHandler, setBatchInterceptor, setBatchListener, setBatchToRecordAdapter, setCommonErrorHandler, setConsumerFactory, setContainerCustomizer, setErrorHandler, setMessageConverter, setMissingTopicsFatal, setPhase, setRecordFilterStrategy, setRecordInterceptor, setRecoveryCallback, setReplyHeadersConfigurer, setReplyTemplate, setRetryTemplate, setStatefulRetry
-
-
-
-
Method Detail
-
setConcurrency
public void setConcurrency(java.lang.Integer concurrency)
Specify the container concurrency.- Parameters:
concurrency
- the number of consumers to create.- See Also:
ConcurrentMessageListenerContainer.setConcurrency(int)
-
createContainerInstance
protected ConcurrentMessageListenerContainer<K,V> createContainerInstance(KafkaListenerEndpoint endpoint)
Description copied from class:AbstractKafkaListenerContainerFactory
Create an empty container instance.- Specified by:
createContainerInstance
in classAbstractKafkaListenerContainerFactory<ConcurrentMessageListenerContainer<K,V>,K,V>
- Parameters:
endpoint
- the endpoint.- Returns:
- the new container instance.
-
initializeContainer
protected void initializeContainer(ConcurrentMessageListenerContainer<K,V> instance, KafkaListenerEndpoint endpoint)
Description copied from class:AbstractKafkaListenerContainerFactory
Further initialize the specified container.Subclasses can inherit from this method to apply extra configuration if necessary.
- Overrides:
initializeContainer
in classAbstractKafkaListenerContainerFactory<ConcurrentMessageListenerContainer<K,V>,K,V>
- Parameters:
instance
- the container instance to configure.endpoint
- the endpoint.
-
-