public class KafkaProducerMessageHandlerSpec extends MessageHandlerSpec<KafkaProducerMessageHandlerSpec,org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler> implements ComponentsRegistration
MessageHandlerSpec implementation for the KafkaProducerMessageHandler.id, logger, PARSER, target| Modifier and Type | Method and Description |
|---|---|
KafkaProducerMessageHandlerSpec |
addProducer(org.springframework.integration.kafka.support.ProducerMetadata producerMetadata,
java.lang.String brokerList)
Add Kafka Producer to this
KafkaProducerMessageHandler
for the provided topic and brokerList. |
protected org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler |
doGet() |
java.util.Collection<java.lang.Object> |
getComponentsToRegister() |
<P> KafkaProducerMessageHandlerSpec |
messageKey(Function<org.springframework.messaging.Message<P>,?> messageKeyFunction)
Configure a
Function that will be invoked at run time to determine the message key under
which a message will be stored in the topic. |
KafkaProducerMessageHandlerSpec |
messageKey(java.lang.String messageKey)
Configure the message key to store message in Kafka topic.
|
KafkaProducerMessageHandlerSpec |
messageKeyExpression(org.springframework.expression.Expression messageKeyExpression)
Configure an
Expression to determine the Kafka message key to store at runtime against
request Message as a root object of evaluation context. |
KafkaProducerMessageHandlerSpec |
messageKeyExpression(java.lang.String messageKeyExpression)
Configure a SpEL expression to determine the Kafka message key to store at runtime against
request Message as a root object of evaluation context.
|
<P> KafkaProducerMessageHandlerSpec |
partitionId(Function<org.springframework.messaging.Message<P>,java.lang.Integer> partitionIdFunction)
Configure a
Function that will be invoked at run time to determine the partition id under
which a message will be stored in the topic. |
KafkaProducerMessageHandlerSpec |
partitionId(java.lang.Integer partitionId)
Configure a partitionId of Kafka topic.
|
KafkaProducerMessageHandlerSpec |
partitionIdExpression(org.springframework.expression.Expression partitionIdExpression)
Configure an
Expression to determine the topic partitionId at runtime against
request Message as a root object of evaluation context. |
KafkaProducerMessageHandlerSpec |
partitionIdExpression(java.lang.String partitionIdExpression)
Configure a SpEL expression to determine the topic partitionId at runtime against
request Message as a root object of evaluation context.
|
<P> KafkaProducerMessageHandlerSpec |
topic(Function<org.springframework.messaging.Message<P>,java.lang.String> topicFunction)
Configure a
Function that will be invoked at run time to determine the topic to
which a message will be sent. |
KafkaProducerMessageHandlerSpec |
topic(java.lang.String topic)
Configure the Kafka topic to send messages.
|
KafkaProducerMessageHandlerSpec |
topicExpression(org.springframework.expression.Expression topicExpression)
Configure an
Expression to determine the Kafka topic at runtime against
request Message as a root object of evaluation context. |
KafkaProducerMessageHandlerSpec |
topicExpression(java.lang.String topicExpression)
Configure a SpEL expression to determine the Kafka topic at runtime against
request Message as a root object of evaluation context.
|
_this, get, getId, idpublic KafkaProducerMessageHandlerSpec topic(java.lang.String topic)
topic - the Kafka topic name.public KafkaProducerMessageHandlerSpec topicExpression(java.lang.String topicExpression)
topicExpression - the topic SpEL expression.public KafkaProducerMessageHandlerSpec topicExpression(org.springframework.expression.Expression topicExpression)
Expression to determine the Kafka topic at runtime against
request Message as a root object of evaluation context.topicExpression - the topic expression.public <P> KafkaProducerMessageHandlerSpec topic(Function<org.springframework.messaging.Message<P>,java.lang.String> topicFunction)
Function that will be invoked at run time to determine the topic to
which a message will be sent. Typically used with a Java 8 Lambda expression:
.<Foo>topic(m -> m.getPayload().getTopic())
P - the expected payload type.topicFunction - the topic function.KafkaProducerMessageHandlerSpec.FunctionExpressionpublic KafkaProducerMessageHandlerSpec messageKeyExpression(java.lang.String messageKeyExpression)
messageKeyExpression - the message key SpEL expression.public KafkaProducerMessageHandlerSpec messageKey(java.lang.String messageKey)
messageKey - the message key to use.public KafkaProducerMessageHandlerSpec messageKeyExpression(org.springframework.expression.Expression messageKeyExpression)
Expression to determine the Kafka message key to store at runtime against
request Message as a root object of evaluation context.messageKeyExpression - the message key expression.public <P> KafkaProducerMessageHandlerSpec messageKey(Function<org.springframework.messaging.Message<P>,?> messageKeyFunction)
Function that will be invoked at run time to determine the message key under
which a message will be stored in the topic. Typically used with a Java 8 Lambda expression:
.<Foo>messageKey(m -> m.getPayload().getKey())
P - the expected payload type.messageKeyFunction - the message key function.KafkaProducerMessageHandlerSpec.FunctionExpressionpublic KafkaProducerMessageHandlerSpec partitionId(java.lang.Integer partitionId)
partitionId - the partitionId to use.public KafkaProducerMessageHandlerSpec partitionIdExpression(java.lang.String partitionIdExpression)
partitionIdExpression - the partitionId expression to use.public <P> KafkaProducerMessageHandlerSpec partitionId(Function<org.springframework.messaging.Message<P>,java.lang.Integer> partitionIdFunction)
Function that will be invoked at run time to determine the partition id under
which a message will be stored in the topic. Typically used with a Java 8 Lambda expression:
.partitionId(m -> m.getHeaders().get("partitionId", Integer.class))
P - the expected payload type.partitionIdFunction - the partitionId function.public KafkaProducerMessageHandlerSpec partitionIdExpression(org.springframework.expression.Expression partitionIdExpression)
Expression to determine the topic partitionId at runtime against
request Message as a root object of evaluation context.partitionIdExpression - the partitionId expression to use.public KafkaProducerMessageHandlerSpec addProducer(org.springframework.integration.kafka.support.ProducerMetadata producerMetadata, java.lang.String brokerList)
KafkaProducerMessageHandler
for the provided topic and brokerList.producerMetadata - the ProducerMetadata - options for Kafka Producer.brokerList - the Kafka brokers (metadata.broker.list)
in the format host1:port1,host2:port2.public java.util.Collection<java.lang.Object> getComponentsToRegister()
getComponentsToRegister in interface ComponentsRegistrationprotected org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler doGet()
doGet in class IntegrationComponentSpec<KafkaProducerMessageHandlerSpec,org.springframework.integration.kafka.outbound.KafkaProducerMessageHandler>