Class KafkaTemplateSpec<K,V>
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<KafkaTemplateSpec<K,V>,org.springframework.kafka.core.KafkaTemplate<K,V>>
org.springframework.integration.kafka.dsl.KafkaTemplateSpec<K,V>
- Type Parameters:
K
- the key type.V
- the value type.
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,DisposableBean
,FactoryBean<org.springframework.kafka.core.KafkaTemplate<K,
,V>> InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
- Direct Known Subclasses:
KafkaOutboundGatewaySpec.ReplyingKafkaTemplateSpec
public class KafkaTemplateSpec<K,V>
extends IntegrationComponentSpec<KafkaTemplateSpec<K,V>,org.springframework.kafka.core.KafkaTemplate<K,V>>
An
IntegrationComponentSpec
implementation for the KafkaTemplate
.- Since:
- 5.4
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, target
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Method Summary
Modifier and TypeMethodDescriptiondefaultTopic
(String defaultTopic) /** Set the default topic for send methods where a topic is not providing.Configure the component identifier.messageConverter
(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter) Set the message converter to use.producerListener
(org.springframework.kafka.support.ProducerListener<K, V> producerListener) Set aProducerListener
which will be invoked when Kafka acknowledges a send operation.Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Method Details
-
getTemplate
-
id
Description copied from class:IntegrationComponentSpec
Configure the component identifier. Used as thebeanName
to register the bean in the application context for this component.- Overrides:
id
in classIntegrationComponentSpec<KafkaTemplateSpec<K,
V>, org.springframework.kafka.core.KafkaTemplate<K, V>> - Parameters:
id
- the id.- Returns:
- the spec.
-
defaultTopic
/** Set the default topic for send methods where a topic is not providing.- Parameters:
defaultTopic
- the topic.- Returns:
- the spec
-
producerListener
public KafkaTemplateSpec<K,V> producerListener(org.springframework.kafka.support.ProducerListener<K, V> producerListener) Set aProducerListener
which will be invoked when Kafka acknowledges a send operation. By default aLoggingProducerListener
is configured which logs errors only.- Parameters:
producerListener
- the listener; may benull
.- Returns:
- the spec
-
messageConverter
public KafkaTemplateSpec<K,V> messageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter) Set the message converter to use.- Parameters:
messageConverter
- the message converter.- Returns:
- the spec
-