public final class Kafka extends Object
Modifier and Type | Method and Description |
---|---|
static KafkaPointToPointChannelSpec |
channel(org.springframework.kafka.core.KafkaTemplate<?,?> template,
org.springframework.kafka.config.KafkaListenerContainerFactory<?> containerFactory,
String topic)
Create a spec for a subscribable channel with the provided parameters.
|
static <K,V> KafkaInboundChannelAdapterSpec<K,V> |
inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.listener.ConsumerProperties consumerProperties)
Create an initial
KafkaInboundChannelAdapterSpec with the consumer factory and
topics. |
static <K,V> KafkaInboundChannelAdapterSpec<K,V> |
inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.listener.ConsumerProperties consumerProperties,
boolean allowMultiFetch)
Create an initial
KafkaInboundChannelAdapterSpec with the consumer factory and
topics. |
static <K,V> KafkaInboundChannelAdapterSpec<K,V> |
inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.listener.ConsumerProperties consumerProperties,
KafkaMessageSource.KafkaAckCallbackFactory<K,V> ackCallbackFactory)
Create an initial
KafkaInboundChannelAdapterSpec with the consumer factory and
topics with a custom ack callback factory. |
static <K,V> KafkaInboundChannelAdapterSpec<K,V> |
inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.listener.ConsumerProperties consumerProperties,
KafkaMessageSource.KafkaAckCallbackFactory<K,V> ackCallbackFactory,
boolean allowMultiFetch)
Create an initial
KafkaInboundChannelAdapterSpec with the consumer factory and
topics with a custom ack callback factory. |
static <K,V,R> KafkaInboundGatewaySpec<K,V,R,?> |
inboundGateway(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> container,
org.springframework.kafka.core.KafkaTemplate<K,R> template)
Create an initial
KafkaInboundGatewaySpec with the provided container and
template. |
static <K,V,R> KafkaInboundGatewaySpec.KafkaInboundGatewayListenerContainerSpec<K,V,R> |
inboundGateway(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.listener.ContainerProperties containerProperties,
org.springframework.kafka.core.ProducerFactory<K,R> producerFactory)
Create an initial
KafkaInboundGatewaySpec with the provided consumer factory,
container properties and producer factory. |
static <K,V,R> KafkaInboundGatewaySpec.KafkaInboundGatewayListenerContainerSpec<K,V,R> |
inboundGateway(KafkaMessageListenerContainerSpec<K,V> containerSpec,
KafkaTemplateSpec<K,R> templateSpec)
Create an initial
KafkaInboundGatewaySpec with the provided container and
template specs. |
static <K,V> KafkaMessageDrivenChannelAdapterSpec<K,V,?> |
messageDrivenChannelAdapter(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> listenerContainer)
Create an initial
KafkaMessageDrivenChannelAdapterSpec . |
static <K,V> KafkaMessageDrivenChannelAdapterSpec<K,V,?> |
messageDrivenChannelAdapter(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> listenerContainer,
KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode)
Create an initial
KafkaMessageDrivenChannelAdapterSpec . |
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.listener.ContainerProperties containerProperties)
|
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.listener.ContainerProperties containerProperties,
KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode)
|
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode,
Pattern topicPattern)
|
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode,
String... topics)
|
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode,
org.springframework.kafka.support.TopicPartitionOffset... topicPartitions)
|
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
Pattern topicPattern)
|
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
String... topics)
|
static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> |
messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory,
org.springframework.kafka.support.TopicPartitionOffset... topicPartitions)
|
static <K,V> KafkaProducerMessageHandlerSpec<K,V,?> |
outboundChannelAdapter(org.springframework.kafka.core.KafkaTemplate<K,V> kafkaTemplate)
Create an initial
KafkaProducerMessageHandlerSpec . |
static <K,V> KafkaProducerMessageHandlerSpec.KafkaProducerMessageHandlerTemplateSpec<K,V> |
outboundChannelAdapter(org.springframework.kafka.core.ProducerFactory<K,V> producerFactory)
Create an initial
KafkaProducerMessageHandlerSpec with ProducerFactory. |
static <K,V,R> KafkaOutboundGatewaySpec.KafkaGatewayMessageHandlerTemplateSpec<K,V,R> |
outboundGateway(org.springframework.kafka.core.ProducerFactory<K,V> producerFactory,
org.springframework.kafka.listener.GenericMessageListenerContainer<K,R> replyContainer)
Create an initial
KafkaProducerMessageHandlerSpec with ProducerFactory. |
static <K,V,R> KafkaOutboundGatewaySpec<K,V,R,?> |
outboundGateway(org.springframework.kafka.requestreply.ReplyingKafkaTemplate<K,V,R> kafkaTemplate)
Create an initial
KafkaProducerMessageHandlerSpec . |
static KafkaPollableChannelSpec |
pollableChannel(org.springframework.kafka.core.KafkaTemplate<?,?> template,
KafkaMessageSource<?,?> source)
Create a spec for a pollable channel with the provided parameters.
|
static KafkaPublishSubscribeChannelSpec |
publishSubscribeChannel(org.springframework.kafka.core.KafkaTemplate<?,?> template,
org.springframework.kafka.config.KafkaListenerContainerFactory<?> containerFactory,
String topic)
Create a spec for a publish/subscribe channel with the provided parameters.
|
public static <K,V> KafkaProducerMessageHandlerSpec<K,V,?> outboundChannelAdapter(org.springframework.kafka.core.KafkaTemplate<K,V> kafkaTemplate)
KafkaProducerMessageHandlerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.kafkaTemplate
- the KafkaTemplate
to usepublic static <K,V> KafkaProducerMessageHandlerSpec.KafkaProducerMessageHandlerTemplateSpec<K,V> outboundChannelAdapter(org.springframework.kafka.core.ProducerFactory<K,V> producerFactory)
KafkaProducerMessageHandlerSpec
with ProducerFactory.K
- the Kafka message key type.V
- the Kafka message value type.producerFactory
- the ProducerFactory
Java 8 Lambda.public static <K,V> KafkaInboundChannelAdapterSpec<K,V> inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.listener.ConsumerProperties consumerProperties)
KafkaInboundChannelAdapterSpec
with the consumer factory and
topics.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the consumer factory.consumerProperties
- the consumerProperties.public static <K,V> KafkaInboundChannelAdapterSpec<K,V> inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.listener.ConsumerProperties consumerProperties, boolean allowMultiFetch)
KafkaInboundChannelAdapterSpec
with the consumer factory and
topics.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the consumer factory.consumerProperties
- the consumerProperties.allowMultiFetch
- true to fetch multiple records on each poll.public static <K,V> KafkaInboundChannelAdapterSpec<K,V> inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.listener.ConsumerProperties consumerProperties, KafkaMessageSource.KafkaAckCallbackFactory<K,V> ackCallbackFactory)
KafkaInboundChannelAdapterSpec
with the consumer factory and
topics with a custom ack callback factory.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the consumer factory.consumerProperties
- the consumerProperties.ackCallbackFactory
- the callback factory.public static <K,V> KafkaInboundChannelAdapterSpec<K,V> inboundChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.listener.ConsumerProperties consumerProperties, KafkaMessageSource.KafkaAckCallbackFactory<K,V> ackCallbackFactory, boolean allowMultiFetch)
KafkaInboundChannelAdapterSpec
with the consumer factory and
topics with a custom ack callback factory.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the consumer factory.consumerProperties
- the consumerProperties.ackCallbackFactory
- the callback factory.allowMultiFetch
- true to fetch multiple records on each poll.public static <K,V> KafkaMessageDrivenChannelAdapterSpec<K,V,?> messageDrivenChannelAdapter(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> listenerContainer)
KafkaMessageDrivenChannelAdapterSpec
. If the listener
container is not already a bean it will be registered in the application context.
If the adapter spec has an id
, the bean name will be that id appended with
'.container'. Otherwise, the bean name will be generated from the container class
name.K
- the Kafka message key type.V
- the Kafka message value type.listenerContainer
- the AbstractMessageListenerContainer
.public static <K,V> KafkaMessageDrivenChannelAdapterSpec<K,V,?> messageDrivenChannelAdapter(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> listenerContainer, KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode)
KafkaMessageDrivenChannelAdapterSpec
. If the listener
container is not already a bean it will be registered in the application context.
If the adapter spec has an id
, the bean name will be that id appended with
'.container'. Otherwise, the bean name will be generated from the container class
name.K
- the Kafka message key type.V
- the Kafka message value type.listenerContainer
- the AbstractMessageListenerContainer
.listenerMode
- the KafkaMessageDrivenChannelAdapter.ListenerMode
.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.listener.ContainerProperties containerProperties)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.containerProperties
- the ContainerProperties
to use.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.listener.ContainerProperties containerProperties, KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.containerProperties
- the ContainerProperties
to use.listenerMode
- the KafkaMessageDrivenChannelAdapter.ListenerMode
.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.support.TopicPartitionOffset... topicPartitions)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.topicPartitions
- the TopicPartitionOffset
vararg.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode, org.springframework.kafka.support.TopicPartitionOffset... topicPartitions)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.listenerMode
- the KafkaMessageDrivenChannelAdapter.ListenerMode
.topicPartitions
- the TopicPartitionOffset
vararg.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, String... topics)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.topics
- the topics vararg.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode, String... topics)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.listenerMode
- the KafkaMessageDrivenChannelAdapter.ListenerMode
.topics
- the topics vararg.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, Pattern topicPattern)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.topicPattern
- the topicPattern vararg.public static <K,V> KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V> messageDrivenChannelAdapter(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, KafkaMessageDrivenChannelAdapter.ListenerMode listenerMode, Pattern topicPattern)
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
.K
- the Kafka message key type.V
- the Kafka message value type.consumerFactory
- the ConsumerFactory
.listenerMode
- the KafkaMessageDrivenChannelAdapter.ListenerMode
.topicPattern
- the topicPattern vararg.public static <K,V,R> KafkaOutboundGatewaySpec<K,V,R,?> outboundGateway(org.springframework.kafka.requestreply.ReplyingKafkaTemplate<K,V,R> kafkaTemplate)
KafkaProducerMessageHandlerSpec
.K
- the Kafka message key type.V
- the Kafka message value type (request).R
- the Kafka message value type (reply).kafkaTemplate
- the ReplyingKafkaTemplate
to usepublic static <K,V,R> KafkaOutboundGatewaySpec.KafkaGatewayMessageHandlerTemplateSpec<K,V,R> outboundGateway(org.springframework.kafka.core.ProducerFactory<K,V> producerFactory, org.springframework.kafka.listener.GenericMessageListenerContainer<K,R> replyContainer)
KafkaProducerMessageHandlerSpec
with ProducerFactory.K
- the Kafka message key type.V
- the Kafka message value type (request).R
- the Kafka message value type (reply).producerFactory
- the ProducerFactory
Java 8 Lambda.replyContainer
- a listener container for replies.public static <K,V,R> KafkaInboundGatewaySpec<K,V,R,?> inboundGateway(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> container, org.springframework.kafka.core.KafkaTemplate<K,R> template)
KafkaInboundGatewaySpec
with the provided container and
template. If the listener container is not already a bean it will be registered in
the application context. If the adapter spec has an id
, the bean name will
be that id appended with '.container'. Otherwise, the bean name will be generated
from the container class name.K
- the Kafka message key type.V
- the Kafka message value type (request).R
- the Kafka message value type (reply).container
- the container.template
- the template.public static <K,V,R> KafkaInboundGatewaySpec.KafkaInboundGatewayListenerContainerSpec<K,V,R> inboundGateway(org.springframework.kafka.core.ConsumerFactory<K,V> consumerFactory, org.springframework.kafka.listener.ContainerProperties containerProperties, org.springframework.kafka.core.ProducerFactory<K,R> producerFactory)
KafkaInboundGatewaySpec
with the provided consumer factory,
container properties and producer factory.K
- the Kafka message key type.V
- the Kafka message value type (request).R
- the Kafka message value type (reply).consumerFactory
- the consumer factory.containerProperties
- the container properties.producerFactory
- the producer factory.public static <K,V,R> KafkaInboundGatewaySpec.KafkaInboundGatewayListenerContainerSpec<K,V,R> inboundGateway(KafkaMessageListenerContainerSpec<K,V> containerSpec, KafkaTemplateSpec<K,R> templateSpec)
KafkaInboundGatewaySpec
with the provided container and
template specs.K
- the Kafka message key type.V
- the Kafka message value type (request).R
- the Kafka message value type (reply).containerSpec
- the container spec.templateSpec
- the template spec.public static KafkaPointToPointChannelSpec channel(org.springframework.kafka.core.KafkaTemplate<?,?> template, org.springframework.kafka.config.KafkaListenerContainerFactory<?> containerFactory, String topic)
template
- the template.containerFactory
- the container factory.topic
- the topic.public static KafkaPublishSubscribeChannelSpec publishSubscribeChannel(org.springframework.kafka.core.KafkaTemplate<?,?> template, org.springframework.kafka.config.KafkaListenerContainerFactory<?> containerFactory, String topic)
template
- the template.containerFactory
- the container factory.topic
- the topic.public static KafkaPollableChannelSpec pollableChannel(org.springframework.kafka.core.KafkaTemplate<?,?> template, KafkaMessageSource<?,?> source)
template
- the template.source
- the source.