Class KafkaProducerMessageHandler<K,​V>

Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Lifecycle, Ordered, ExpressionCapable, Orderable, MessageProducer, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, ManageableLifecycle, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class KafkaProducerMessageHandler<K,​V>
extends AbstractReplyProducingMessageHandler
implements ManageableLifecycle
Kafka Message Handler; when supplied with a ReplyingKafkaTemplate it is used as the handler in an outbound gateway. When supplied with a simple KafkaTemplate it used as the handler in an outbound channel adapter.

Starting with version 3.2.1 the handler supports receiving a pre-built ProducerRecord payload. In that case, most configuration properties (setTopicExpression(Expression) etc.) are ignored. If the handler is used as gateway, the ProducerRecord will have its headers enhanced to add the KafkaHeaders.REPLY_TOPIC unless it already contains such a header. The handler will not map any additional headers; providing such a payload assumes the headers have already been mapped.

Since:
5.4
Author:
Soby Chacko, Artem Bilan, Gary Russell, Marius Bogoevici, Biju Kunjummen, Tom van den Berge